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,6 +1,6 @@
|
||||
use crate::{
|
||||
serve::{ansi_buffer::ansi_string_to_line, ServeUpdate, WebServer},
|
||||
BuildId, BuildStage, BuilderUpdate, Platform, TraceContent, TraceMsg, TraceSrc,
|
||||
BuildId, BuildStage, BuilderUpdate, BundleFormat, TraceContent, TraceMsg, TraceSrc,
|
||||
};
|
||||
use cargo_metadata::diagnostic::Diagnostic;
|
||||
use crossterm::{
|
||||
@@ -316,12 +316,12 @@ impl Output {
|
||||
/// Add a message from stderr to the logs
|
||||
/// This will queue the stderr message as a TraceMsg and print it on the next render
|
||||
/// We'll use the `App` TraceSrc for the msg, and whatever level is provided
|
||||
pub fn push_stdio(&mut self, platform: Platform, msg: String, level: Level) {
|
||||
self.push_log(TraceMsg::text(TraceSrc::App(platform), level, msg));
|
||||
pub fn push_stdio(&mut self, bundle: BundleFormat, msg: String, level: Level) {
|
||||
self.push_log(TraceMsg::text(TraceSrc::App(bundle), level, msg));
|
||||
}
|
||||
|
||||
/// Push a message from the websocket to the logs
|
||||
pub fn push_ws_message(&mut self, platform: Platform, message: &axum::extract::ws::Message) {
|
||||
pub fn push_ws_message(&mut self, bundle: BundleFormat, message: &axum::extract::ws::Message) {
|
||||
use dioxus_devtools_types::ClientMsg;
|
||||
|
||||
// We can only handle text messages from the websocket...
|
||||
@@ -336,7 +336,7 @@ impl Output {
|
||||
let msg = match res {
|
||||
Ok(msg) => msg,
|
||||
Err(err) => {
|
||||
tracing::error!(dx_src = ?TraceSrc::Dev, "Error parsing message from {}: {} -> {:?}", platform, err, text.as_str());
|
||||
tracing::error!(dx_src = ?TraceSrc::Dev, "Error parsing message from {}: {} -> {:?}", bundle, err, text.as_str());
|
||||
return;
|
||||
}
|
||||
};
|
||||
@@ -358,7 +358,7 @@ impl Output {
|
||||
};
|
||||
|
||||
// We don't care about logging the app's message so we directly push it instead of using tracing.
|
||||
self.push_log(TraceMsg::text(TraceSrc::App(platform), level, content));
|
||||
self.push_log(TraceMsg::text(TraceSrc::App(bundle), level, content));
|
||||
}
|
||||
|
||||
/// Change internal state based on the build engine's update
|
||||
@@ -641,7 +641,7 @@ impl Output {
|
||||
frame.render_widget(
|
||||
Paragraph::new(Line::from(vec![
|
||||
"Platform: ".gray(),
|
||||
client.build.platform.expected_name().yellow(),
|
||||
client.build.bundle.expected_name().yellow(),
|
||||
if state.runner.is_fullstack() {
|
||||
" + fullstack".yellow()
|
||||
} else {
|
||||
@@ -672,7 +672,7 @@ impl Output {
|
||||
|
||||
frame.render_widget_ref(
|
||||
Paragraph::new(Line::from(vec![
|
||||
if client.build.platform == Platform::Web {
|
||||
if client.build.bundle == BundleFormat::Web {
|
||||
"Serving at: ".gray()
|
||||
} else {
|
||||
"Server at: ".gray()
|
||||
@@ -755,7 +755,7 @@ impl Output {
|
||||
);
|
||||
|
||||
let server_address = match state.server.server_address() {
|
||||
Some(address) => format!("http://{}", address).yellow(),
|
||||
Some(address) => format!("http://{address}").yellow(),
|
||||
None => "no address".dark_gray(),
|
||||
};
|
||||
frame.render_widget(
|
||||
@@ -770,7 +770,7 @@ impl Output {
|
||||
frame.render_widget(
|
||||
Paragraph::new(Line::from(vec![
|
||||
"Read the docs: ".gray(),
|
||||
"https://dioxuslabs.com/0.6/docs".blue(),
|
||||
"https://dioxuslabs.com/learn/0.7/".blue(),
|
||||
])),
|
||||
links_list[0],
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user