DX components command (#4669)

* add component subcommand

* add dx component add, remove and list commands

* handle rust dependencies

* handle component dependencies

* fetch remote registries

* sort components before listing them

* remove local dependency

* move te component manifest into the dioxus workspace

* add additional instalation instructions the first time the component
module is created

* fix mod name

* fix clippy

* improve docs and move to the main branch of components

* fix typos

* more typos

* undo const-serialize changes

* remove a few unwraps

* Allow adding multiple components at once and add a `--all` flag

* add options to the config for the base path, global asset path and
default registry

* component_path -> component_dir

* component_dir is always relative to the crate root

* fix clippy

* fix request imports

* wip: code style changes

* rename to "components" instead of "component"

* bump lock

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
Evan AlmloffandJonathan Kelley authored and GitHub committed 2025-10-20 17:20:46 -04:00
1 parent b3966c3509
commit 79613f9db9
18 files changed
+1101 -17

No files matched your search

+43
View File
@@ -29,6 +29,7 @@
//! - set `dx config set disable-telemetry true`
//!
use crate::component::ComponentCommand;
use crate::{dx_build_info::GIT_COMMIT_HASH_SHORT, serve::ServeUpdate, Cli, Commands, Verbosity};
use crate::{BundleFormat, CliSettings, Workspace};
use anyhow::{bail, Context, Error, Result};
@@ -68,6 +69,10 @@ const DX_SRC_FLAG: &str = "dx_src";
pub static VERBOSITY: OnceLock<Verbosity> = OnceLock::new();
pub fn verbosity_or_default() -> Verbosity {
crate::VERBOSITY.get().cloned().unwrap_or_default()
}
fn reset_cursor() {
use std::io::IsTerminal;
@@ -902,6 +907,44 @@ impl TraceController {
Print::ClientArgs(_args) => ("print client-args".to_string(), json!({})),
Print::ServerArgs(_args) => ("print server-args".to_string(), json!({})),
},
Commands::Components(cmd) => match cmd {
ComponentCommand::Add {
component,
registry,
force,
} => (
"components add".to_string(),
json!({
"component": component,
"registry": registry,
"force": force,
}),
),
ComponentCommand::Remove {
component,
registry,
} => (
"components remove".to_string(),
json!({
"component": component,
"registry": registry,
}),
),
ComponentCommand::Update { registry } => (
"components update".to_string(),
json!({
"registry": registry,
}),
),
ComponentCommand::List { registry } => (
"components list".to_string(),
json!({
"registry": registry,
}),
),
ComponentCommand::Clean => ("components clean".to_string(), json!({})),
ComponentCommand::Schema => ("components schema".to_string(), json!({})),
},
}
}