pull out the CLI config data into a separate library
This commit is contained in:
1 parent
8ea7f076e5
commit
8a2d170d96
18 files changed
+919
-36
No files matched your search
@@ -1,6 +1,6 @@
|
||||
use crate::cfg::Platform;
|
||||
#[cfg(feature = "plugin")]
|
||||
use crate::plugin::PluginManager;
|
||||
use dioxus_cli_config::Platform;
|
||||
|
||||
use super::*;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use clap::ValueEnum;
|
||||
use serde::Serialize;
|
||||
use dioxus_cli_config::Platform;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -91,16 +90,6 @@ pub struct ConfigOptsServe {
|
||||
pub features: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum, Serialize, Deserialize, Debug)]
|
||||
pub enum Platform {
|
||||
#[clap(name = "web")]
|
||||
#[serde(rename = "web")]
|
||||
Web,
|
||||
#[clap(name = "desktop")]
|
||||
#[serde(rename = "desktop")]
|
||||
Desktop,
|
||||
}
|
||||
|
||||
/// Config options for the bundling system.
|
||||
#[derive(Clone, Debug, Default, Deserialize, Parser)]
|
||||
pub struct ConfigOptsBundle {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use dioxus_cli_config::crate_root;
|
||||
|
||||
use super::*;
|
||||
|
||||
/// Dioxus config file controls
|
||||
@@ -26,7 +28,7 @@ pub enum Config {
|
||||
|
||||
impl Config {
|
||||
pub fn config(self) -> Result<()> {
|
||||
let crate_root = crate::cargo::crate_root()?;
|
||||
let crate_root = crate_root()?;
|
||||
match self {
|
||||
Config::Init {
|
||||
name,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use dioxus_cli_config::Platform;
|
||||
|
||||
use super::*;
|
||||
use std::{fs::create_dir_all, io::Write, path::PathBuf};
|
||||
|
||||
@@ -40,7 +42,7 @@ impl Serve {
|
||||
.unwrap_or(crate_config.dioxus_config.application.default_platform);
|
||||
|
||||
match platform {
|
||||
cfg::Platform::Web => {
|
||||
Platform::Web => {
|
||||
// generate dev-index page
|
||||
Serve::regen_dev_page(&crate_config)?;
|
||||
|
||||
@@ -48,7 +50,7 @@ impl Serve {
|
||||
server::web::startup(self.serve.port, crate_config.clone(), self.serve.open)
|
||||
.await?;
|
||||
}
|
||||
cfg::Platform::Desktop => {
|
||||
Platform::Desktop => {
|
||||
server::desktop::startup(crate_config.clone()).await?;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user