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:
1 parent
b3966c3509
commit
79613f9db9
18 files changed
+1101
-17
No files matched your search
@@ -3,6 +3,10 @@ use std::path::PathBuf;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub(crate) struct ApplicationConfig {
|
||||
/// The path where global assets will be added when components are added with `dx components add`
|
||||
#[serde(default)]
|
||||
pub(crate) asset_dir: Option<PathBuf>,
|
||||
|
||||
#[serde(default)]
|
||||
pub(crate) out_dir: Option<PathBuf>,
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
use crate::component::ComponentRegistry;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Configuration for the `dioxus component` commands
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub(crate) struct ComponentConfig {
|
||||
/// The component registry to default to when adding components
|
||||
#[serde(default)]
|
||||
pub(crate) registry: ComponentRegistry,
|
||||
|
||||
/// The path where components are stored when adding or removing components
|
||||
#[serde(default)]
|
||||
pub(crate) components_dir: Option<PathBuf>,
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
use crate::config::component::ComponentConfig;
|
||||
|
||||
use super::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -10,12 +12,16 @@ pub(crate) struct DioxusConfig {
|
||||
|
||||
#[serde(default)]
|
||||
pub(crate) bundle: BundleConfig,
|
||||
|
||||
#[serde(default)]
|
||||
pub(crate) components: ComponentConfig,
|
||||
}
|
||||
|
||||
impl Default for DioxusConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
application: ApplicationConfig {
|
||||
asset_dir: None,
|
||||
out_dir: None,
|
||||
public_dir: Some("public".into()),
|
||||
tailwind_input: None,
|
||||
@@ -53,6 +59,7 @@ impl Default for DioxusConfig {
|
||||
wasm_opt: Default::default(),
|
||||
},
|
||||
bundle: BundleConfig::default(),
|
||||
components: ComponentConfig::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
mod app;
|
||||
mod bundle;
|
||||
mod component;
|
||||
mod dioxus_config;
|
||||
mod serve;
|
||||
mod web;
|
||||
|
||||
Reference in new issue
Block a user