Add liveview support to the CLI and make fullstack runnable from dist (#2759)

* add liveview cli support
* Fix TUI fullstack deadlock
* look for fullstack assets in the public directory
* Fix fullstack with the CLI
* Fix static generation server
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-08-01 17:46:35 -07:00
1 parent 9dbdf74a1e
commit e5e578d27b
14 files changed
+428 -272

No files matched your search

+6 -10
View File
@@ -1,10 +1,11 @@
use crate::builder::Build;
use crate::dioxus_crate::DioxusCrate;
use dioxus_cli_config::Platform;
use crate::builder::BuildRequest;
use std::path::PathBuf;
use super::TargetPlatform;
static CLIENT_RUST_FLAGS: &[&str] = &["-Cdebuginfo=none", "-Cstrip=debuginfo"];
// The `opt-level=2` increases build times, but can noticeably decrease time
// between saving changes and being able to interact with an app. The "overall"
@@ -56,15 +57,10 @@ impl BuildRequest {
target_directory: PathBuf,
rust_flags: &[&str],
feature: String,
web: bool,
target_platform: TargetPlatform,
) -> Self {
let config = config.clone();
let mut build = build.clone();
build.platform = Some(if web {
Platform::Web
} else {
Platform::Desktop
});
// Set the target directory we are building the server in
let target_dir = get_target_directory(&build, target_directory);
// Add the server feature to the features we pass to the build
@@ -74,12 +70,12 @@ impl BuildRequest {
let rust_flags = fullstack_rust_flags(&build, rust_flags);
Self {
web,
serve,
build_arguments: build.clone(),
dioxus_crate: config,
rust_flags,
target_dir,
target_platform,
}
}
@@ -91,7 +87,7 @@ impl BuildRequest {
config.server_target_dir(),
SERVER_RUST_FLAGS,
build.target_args.server_feature.clone(),
false,
TargetPlatform::Server,
)
}
@@ -103,7 +99,7 @@ impl BuildRequest {
config.client_target_dir(),
CLIENT_RUST_FLAGS,
build.target_args.client_feature.clone(),
true,
TargetPlatform::Web,
)
}
}