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

+18
View File
@@ -556,6 +556,24 @@ impl Workspace {
pub(crate) fn global_settings_file() -> PathBuf {
Self::dioxus_data_dir().join("settings.toml")
}
/// The path where components downloaded from git are cached
pub(crate) fn component_cache_dir() -> PathBuf {
Self::dioxus_data_dir().join("components")
}
/// Get the path to a specific component in the cache
pub(crate) fn component_cache_path(git: &str, rev: Option<&str>) -> PathBuf {
use std::hash::Hasher;
let mut hasher = std::hash::DefaultHasher::new();
std::hash::Hash::hash(git, &mut hasher);
if let Some(rev) = rev {
std::hash::Hash::hash(rev, &mut hasher);
}
let hash = hasher.finish();
Self::component_cache_dir().join(format!("{hash:016x}"))
}
}
impl std::fmt::Debug for Workspace {