feat: default plugin info

This commit is contained in:
YuKun Liu committed 2022-11-03 00:30:47 -07:00
1 parent 39e38917d6
commit bbc9e1b3a2
3 files changed
+8 -3

No files matched your search

View File
Whitespace-only changes.
+8 -2
View File
@@ -6,9 +6,15 @@ use std::{collections::HashMap, fs::File, io::Read, path::PathBuf};
pub struct DioxusConfig {
pub application: ApplicationConfig,
pub web: WebConfig,
#[serde(default = "default_plugin")]
pub plugin: toml::Value,
}
fn default_plugin() -> toml::Value {
toml::Value::Boolean(true)
}
impl DioxusConfig {
pub fn load() -> crate::error::Result<DioxusConfig> {
let crate_dir = crate::cargo::crate_root()?;
@@ -23,7 +29,7 @@ impl DioxusConfig {
dioxus_conf_file.read_to_string(&mut meta_str)?;
toml::from_str::<DioxusConfig>(&meta_str)
.map_err(|_| crate::Error::Unique("Dioxus.toml parse failed".into()))
.map_err(|_| crate::Error::Unique("Dioxus.toml parse failed".into()))
}
}
@@ -59,7 +65,7 @@ impl Default for DioxusConfig {
script: Some(vec![]),
},
},
plugin: toml::Value::Table(toml::map::Map::new())
plugin: toml::Value::Table(toml::map::Map::new()),
}
}
}
-1
View File
@@ -108,7 +108,6 @@ pub async fn startup_hot_reload(port: u16, config: CrateConfig) -> Result<()> {
.clone()
.unwrap_or_else(|| vec![PathBuf::from("src")]);
let watcher_config = config.clone();
let watcher_config = config.clone();
let mut watcher = RecommendedWatcher::new(
move |evt: notify::Result<notify::Event>| {