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:
28 files changed
+998
-549
No files matched your search
@@ -1,5 +1,5 @@
|
||||
use crate::{
|
||||
config::WebHttpsConfig, serve::ServeUpdate, BuildId, BuildStage, BuilderUpdate, Platform,
|
||||
config::WebHttpsConfig, serve::ServeUpdate, BuildId, BuildStage, BuilderUpdate, BundleFormat,
|
||||
Result, TraceSrc,
|
||||
};
|
||||
use anyhow::{bail, Context};
|
||||
@@ -62,7 +62,7 @@ pub(crate) struct WebServer {
|
||||
new_build_status_sockets: UnboundedReceiver<ConnectedWsClient>,
|
||||
build_status: SharedStatus,
|
||||
application_name: String,
|
||||
platform: Platform,
|
||||
bundle: BundleFormat,
|
||||
}
|
||||
|
||||
pub(crate) struct ConnectedWsClient {
|
||||
@@ -128,7 +128,7 @@ impl WebServer {
|
||||
new_hot_reload_sockets: hot_reload_sockets_rx,
|
||||
new_build_status_sockets: build_status_sockets_rx,
|
||||
application_name: runner.app_name().to_string(),
|
||||
platform: runner.client.build.platform,
|
||||
bundle: runner.client.build.bundle,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ impl WebServer {
|
||||
drop(new_message);
|
||||
|
||||
// Update the socket with project info and current build status
|
||||
let project_info = SharedStatus::new(Status::ClientInit { application_name: self.application_name.clone(), platform: self.platform });
|
||||
let project_info = SharedStatus::new(Status::ClientInit { application_name: self.application_name.clone(), bundle: self.bundle });
|
||||
if project_info.send_to(&mut new_socket.socket).await.is_ok() {
|
||||
_ = self.build_status.send_to(&mut new_socket.socket).await;
|
||||
self.build_status_sockets.push(new_socket);
|
||||
@@ -175,7 +175,7 @@ impl WebServer {
|
||||
}
|
||||
Some((idx, message)) = new_message.next() => {
|
||||
match message {
|
||||
Some(Ok(msg)) => return ServeUpdate::WsMessage { msg, platform: Platform::Web },
|
||||
Some(Ok(msg)) => return ServeUpdate::WsMessage { msg, bundle: BundleFormat::Web },
|
||||
_ => {
|
||||
drop(new_message);
|
||||
_ = self.hot_reload_sockets.remove(idx);
|
||||
@@ -375,8 +375,8 @@ impl WebServer {
|
||||
}
|
||||
|
||||
pub fn server_address(&self) -> Option<SocketAddr> {
|
||||
match self.platform {
|
||||
Platform::Web | Platform::Server => Some(self.devserver_address()),
|
||||
match self.bundle {
|
||||
BundleFormat::Web | BundleFormat::Server => Some(self.devserver_address()),
|
||||
_ => self.proxied_server_address(),
|
||||
}
|
||||
}
|
||||
@@ -461,8 +461,7 @@ fn build_devserver_router(
|
||||
Response::builder()
|
||||
.status(StatusCode::INTERNAL_SERVER_ERROR)
|
||||
.body(Body::from(format!(
|
||||
"Backend connection failed. The backend is likely still starting up. Please try again in a few seconds. Error: {:#?}",
|
||||
error
|
||||
"Backend connection failed. The backend is likely still starting up. Please try again in a few seconds. Error: {error:#?}"
|
||||
)))
|
||||
.unwrap()
|
||||
},
|
||||
@@ -577,7 +576,7 @@ fn build_serve_dir(runner: &AppServer) -> axum::routing::MethodRouter {
|
||||
.handle_error(|error: Infallible| async move {
|
||||
(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
format!("Unhandled internal error: {}", error),
|
||||
format!("Unhandled internal error: {error}"),
|
||||
)
|
||||
})
|
||||
}
|
||||
@@ -730,7 +729,7 @@ struct SharedStatus(Arc<RwLock<Status>>);
|
||||
enum Status {
|
||||
ClientInit {
|
||||
application_name: String,
|
||||
platform: Platform,
|
||||
bundle: BundleFormat,
|
||||
},
|
||||
Building {
|
||||
progress: f64,
|
||||
|
||||
Reference in new issue
Block a user