CLI: add --renderer argument (#4320)

* Add --renderer argument to the CLI

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Make `--platform native` work

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Emit `krates` error when cargo metadata fails

* Reinstate default "desktop" feature for examples

* Remove commented 'no platform specified' error

Signed-off-by: Nico Burns <nico@nicoburns.com>

* use the target tripple and bundle format as the source of truth for the build

* resolve renderer and bundle format

* add shorthand flags

* add headings to the help for shorthands

* resolve the renderer from the target triple if it isn't passed

* make value after --fullstack optional

* convert desktop -> mobile when targeting mobile webview

* use the new shorthand flags in the playwright tests

* fix clippy

* merge fix

* cleanup merge conflicts

* fix clippy

* remove nit

* restore platform as a legacy argument

* improve help message

* vendor openssl on native, pin server_fn

* print build errors as warnings

* add --desktop arg compat

* adjust cli headings

* prefer self.is_wasm_or_wasi()

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
This commit is contained in:
authored and GitHub committed 2025-07-22 14:32:54 -07:00
1 parent 4848e714ae
commit b257e7e8ce
28 files changed
+998 -549

No files matched your search

+11 -10
View File
@@ -1,7 +1,7 @@
use super::{AppBuilder, ServeUpdate, WebServer};
use crate::{
platform_override::CommandWithPlatformOverrides, BuildArtifacts, BuildId, BuildMode,
BuildTargets, BuilderUpdate, HotpatchModuleCache, Platform, Result, ServeArgs, TailwindCli,
BuildTargets, BuilderUpdate, BundleFormat, HotpatchModuleCache, Result, ServeArgs, TailwindCli,
TraceSrc, Workspace,
};
use anyhow::{bail, Context};
@@ -151,8 +151,8 @@ impl AppServer {
// All servers will end up behind us (the devserver) but on a different port
// This is so we can serve a loading screen as well as devtools without anything particularly fancy
let fullstack = server.is_some();
let should_proxy_port = match client.platform {
Platform::Server => true,
let should_proxy_port = match client.bundle {
BundleFormat::Server => true,
_ => fullstack && !ssg,
};
@@ -168,7 +168,7 @@ impl AppServer {
// Only start Tailwind watcher for client builds that serve assets (not server builds or fullstack mode)
// In fullstack mode, the client build's prebuild() handles Tailwind generation to avoid race conditions
let tw_watcher = if client.build.platform != Platform::Server && !fullstack {
let tw_watcher = if client.build.bundle != BundleFormat::Server && !fullstack {
TailwindCli::serve(
client.build.package_manifest_dir(),
client.build.config.application.tailwind_input.clone(),
@@ -536,7 +536,8 @@ impl AppServer {
use crate::styles::NOTE_STYLE;
tracing::info!(dx_src = ?TraceSrc::Dev, "Hotreloading: {NOTE_STYLE}{}{NOTE_STYLE:#}", file);
if !server.has_hotreload_sockets() && self.client.build.platform != Platform::Web {
if !server.has_hotreload_sockets() && self.client.build.bundle != BundleFormat::Web
{
tracing::warn!("No clients to hotreload - try reloading the app!");
}
@@ -554,8 +555,8 @@ impl AppServer {
devserver: &mut WebServer,
) -> Result<()> {
// Make sure to save artifacts regardless of if we're opening the app or not
match artifacts.platform {
Platform::Server => {
match artifacts.bundle {
BundleFormat::Server => {
if let Some(server) = self.server.as_mut() {
server.artifacts = Some(artifacts.clone());
}
@@ -661,7 +662,7 @@ impl AppServer {
// If the client is running on Android, we need to remove the port forwarding
// todo: use the android tools "adb"
if matches!(self.client.build.platform, Platform::Android) {
if matches!(self.client.build.bundle, BundleFormat::Android) {
if let Err(err) = Command::new(&self.workspace.android_tools()?.adb)
.arg("reverse")
.arg("--remove")
@@ -786,7 +787,7 @@ impl AppServer {
BuildId::CLIENT => {
// multiple tabs on web can cause this to be called incorrectly, and it doesn't
// make any sense anyways
if self.client.build.platform != Platform::Web {
if self.client.build.bundle != BundleFormat::Web {
if let Some(aslr_reference) = aslr_reference {
self.client.aslr_reference = Some(aslr_reference);
}
@@ -804,7 +805,7 @@ impl AppServer {
}
// Assign the runtime asset dir to the runner
if self.client.build.platform == Platform::Ios {
if self.client.build.bundle == BundleFormat::Ios {
// xcrun simctl get_app_container booted com.dioxuslabs
let res = Command::new("xcrun")
.arg("simctl")