Merge branch 'main' into jk/fix-form-inputs

This commit is contained in:
Jonathan Kelley 2024-03-06 16:43:33 -08:00
commit 08d054f5c8
No known key found for this signature in database
GPG key ID: 1FBB50F7EB0A08BE
3 changed files with 20 additions and 6 deletions

2
Cargo.lock generated
View file

@ -2317,7 +2317,7 @@ dependencies = [
name = "dioxus-cli-config"
version = "0.5.0-alpha.0"
dependencies = [
"cargo_toml 0.16.3",
"cargo_toml 0.18.0",
"clap 4.4.18",
"once_cell",
"serde",

View file

@ -13,7 +13,7 @@ clap = { version = "4.2", features = ["derive"], optional = true }
serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.79"
toml = { workspace = true, optional = true }
cargo_toml = { version = "0.16.0", optional = true }
cargo_toml = { version = "0.18.0", optional = true }
once_cell = "1.18.0"
tracing = { workspace = true }

View file

@ -2,6 +2,7 @@ use dioxus_cli_config::Platform;
use manganis_cli_support::AssetManifest;
use super::*;
use cargo_toml::Dependency::{Detailed, Inherited, Simple};
use std::{fs::create_dir_all, io::Write, path::PathBuf};
/// Run the WASM project on dev-server
@ -41,10 +42,23 @@ impl Serve {
crate_config.set_cargo_args(self.serve.cargo_args);
let platform = self
.serve
.platform
.unwrap_or(crate_config.dioxus_config.application.default_platform);
let mut platform = self.serve.platform;
if platform.is_none() {
if let Some(dependency) = &crate_config.manifest.dependencies.get("dioxus") {
let features = match dependency {
Inherited(detail) => detail.features.to_vec(),
Detailed(detail) => detail.features.to_vec(),
Simple(_) => vec![],
};
platform = features
.iter()
.find_map(|platform| serde_json::from_str(&format!(r#""{}""#, platform)).ok());
}
}
let platform = platform.unwrap_or(crate_config.dioxus_config.application.default_platform);
match platform {
Platform::Web => {