CLI self-updater, warn on version mismatch, direct install.sh option, androidmanifest and info.plist customization, bump to 0.7-alpha.0 (#4095)

* wip.... bun installer

* - warn on incompatible versions
- clean up some logs
- add coloring to log levels

* add toasts to desktop/mobile

* Auto open simulators

* auto boot android

* preserve url

* pull out some of the warnings

* add self-updater

* wip: mcp

* add install.sh and adjust binstall path

* add some cuter styling to logs!

* update "input.css"

* update other input.css

* style a bit more

* change getting started

* add windows installer

* move dioxus-mobile into dioxus-desktop
add sentry wip to cli

* shorten timeout of toast

* fix cli display

* wire up customization of android manifest

* udid is a real word

* add 429 to lychee cache

* accept all 200-204 and 429
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2025-05-14 08:43:11 +02:00
1 parent 53ef78823d
commit 4d3d55a7a3
56 files changed
+1560 -548

No files matched your search

+17 -17
View File
@@ -1,4 +1,7 @@
use crate::{AppBuilder, BuildId, BuildMode, BuilderUpdate, Result, ServeArgs, TraceController};
use crate::{
styles::{GLOW_STYLE, LINK_STYLE},
AppBuilder, BuildId, BuildMode, BuilderUpdate, Result, ServeArgs, TraceController,
};
mod ansi_buffer;
mod output;
@@ -34,26 +37,25 @@ pub(crate) use update::*;
/// - I want us to be able to detect a `server_fn` in the project and then upgrade from a static server
/// to a dynamic one on the fly.
pub(crate) async fn serve_all(args: ServeArgs, tracer: &mut TraceController) -> Result<()> {
// Load the args into a plan, resolving all tooling, build dirs, arguments, decoding the multi-target, etc
let mut builder = AppServer::start(args).await?;
let mut devserver = WebServer::start(&builder)?;
let mut screen = Output::start(builder.interactive).await?;
// This is our default splash screen. We might want to make this a fancier splash screen in the future
// Also, these commands might not be the most important, but it's all we've got enabled right now
tracing::info!(
r#"-----------------------------------------------------------------
Serving your Dioxus app: {} 🚀
• Press `ctrl+c` to exit the server
• Press `r` to rebuild the app
• Press `p` to toggle automatic rebuilds
• Press `v` to toggle verbose logging
• Press `/` for more commands and shortcuts
Learn more at https://dioxuslabs.com/learn/0.6/getting_started
Serving your Dioxus app! 🚀
• Press {GLOW_STYLE}`ctrl+c`{GLOW_STYLE:#} to exit the server
• Press {GLOW_STYLE}`r`{GLOW_STYLE:#} to rebuild the app
• Press {GLOW_STYLE}`p`{GLOW_STYLE:#} to toggle automatic rebuilds
• Press {GLOW_STYLE}`v`{GLOW_STYLE:#} to toggle verbose logging
• Press {GLOW_STYLE}`/`{GLOW_STYLE:#} for more commands and shortcuts
Learn more at {LINK_STYLE}https://dioxuslabs.com/learn/0.7/getting_started{LINK_STYLE:#}
----------------------------------------------------------------"#,
builder.app_name()
);
// Load the args into a plan, resolving all tooling, build dirs, arguments, decoding the multi-target, etc
let mut builder = AppServer::start(args).await?;
let mut devserver = WebServer::start(&builder)?;
let mut screen = Output::start(builder.interactive).await?;
loop {
// Draw the state of the server to the screen
screen.render(&builder, &devserver);
@@ -89,7 +91,6 @@ pub(crate) async fn serve_all(args: ServeArgs, tracer: &mut TraceController) ->
// Run the server in the background
// Waiting for updates here lets us tap into when clients are added/removed
ServeUpdate::NewConnection { id, aslr_reference } => {
// Send the client
devserver
.send_hotreload(builder.applied_hot_reload_changes(BuildId::CLIENT))
.await;
@@ -128,7 +129,7 @@ pub(crate) async fn serve_all(args: ServeArgs, tracer: &mut TraceController) ->
screen.push_cargo_log(message);
}
BuilderUpdate::BuildFailed { err } => {
tracing::error!("Build failed: {:#?}", err);
tracing::error!("Build failed: {}", err);
}
BuilderUpdate::BuildReady { bundle } => match bundle.mode {
BuildMode::Thin { ref cache, .. } => {
@@ -204,7 +205,6 @@ pub(crate) async fn serve_all(args: ServeArgs, tracer: &mut TraceController) ->
ServeUpdate::Exit { error } => {
_ = builder.cleanup_all().await;
_ = devserver.shutdown().await;
_ = screen.shutdown();
match error {
Some(err) => return Err(anyhow::anyhow!("{}", err).into()),
+16 -11
View File
@@ -163,13 +163,6 @@ impl Output {
Ok(())
}
/// Call the shutdown functions that might mess with the terminal settings - see the related code
/// in "startup" for more details about what we need to unset
pub(crate) fn shutdown(&self) -> io::Result<()> {
Self::remote_shutdown(self.interactive)?;
Ok(())
}
pub(crate) fn remote_shutdown(interactive: bool) -> io::Result<()> {
if interactive {
stdout()
@@ -966,11 +959,23 @@ impl Output {
" ".repeat(3usize.saturating_sub(log.source.to_string().len()))
))
.style(match log.source {
TraceSrc::App(_platform) => Style::new().blue(),
TraceSrc::Dev => Style::new().magenta(),
TraceSrc::Build => Style::new().yellow(),
TraceSrc::Bundle => Style::new().magenta(),
TraceSrc::App(_platform) => match log.level {
Level::ERROR => Style::new().red(),
Level::WARN => Style::new().yellow(),
Level::INFO => Style::new().magenta(),
Level::DEBUG => Style::new().magenta(),
Level::TRACE => Style::new().magenta(),
},
TraceSrc::Dev => match log.level {
Level::ERROR => Style::new().red(),
Level::WARN => Style::new().yellow(),
Level::INFO => Style::new().blue(),
Level::DEBUG => Style::new().blue(),
Level::TRACE => Style::new().blue(),
},
TraceSrc::Cargo => Style::new().yellow(),
TraceSrc::Build => Style::new().blue(),
TraceSrc::Bundle => Style::new().blue(),
TraceSrc::Unknown => Style::new().gray(),
}),
);
+19 -6
View File
@@ -155,10 +155,12 @@ impl AppServer {
client.build.package_manifest_dir(),
client.build.config.application.tailwind_input.clone(),
client.build.config.application.tailwind_output.clone(),
)
.await?;
);
tracing::debug!("Proxied port: {:?}", proxied_port);
_ = client.build.start_simulators().await;
// Encourage the user to update to a new dx version
crate::update::log_if_cli_could_update();
// Create the runner
let mut runner = Self {
@@ -446,7 +448,13 @@ impl AppServer {
// Also make sure the builder isn't busy since that might cause issues with hotreloads
// https://github.com/DioxusLabs/dioxus/issues/3361
if !msg.is_empty() && self.client.can_receive_hotreloads() {
tracing::info!(dx_src = ?TraceSrc::Dev, "Hotreloading: {}", file);
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 {
tracing::warn!("No clients to hotreload - try reloading the app!");
}
server.send_hotreload(msg).await;
} else {
tracing::debug!(dx_src = ?TraceSrc::Dev, "Ignoring file change: {}", file);
@@ -473,6 +481,8 @@ impl AppServer {
let should_open = self.client.stage == BuildStage::Success
&& (self.server.as_ref().map(|s| s.stage == BuildStage::Success)).unwrap_or(true);
use crate::cli::styles::GLOW_STYLE;
if should_open {
let time_taken = artifacts
.time_end
@@ -481,11 +491,14 @@ impl AppServer {
if self.client.builds_opened == 0 {
tracing::info!(
"Build completed successfully in {:?}ms, launching app! 💫",
"Build completed successfully in {GLOW_STYLE}{:?}ms{GLOW_STYLE:#}, launching app! 💫",
time_taken.as_millis()
);
} else {
tracing::info!("Build completed in {:?}ms", time_taken.as_millis());
tracing::info!(
"Build completed in {GLOW_STYLE}{:?}ms{GLOW_STYLE:#}",
time_taken.as_millis()
);
}
let open_browser = self.client.builds_opened == 0 && self.open_browser;
+4
View File
@@ -264,6 +264,10 @@ impl WebServer {
}
}
pub(crate) fn has_hotreload_sockets(&self) -> bool {
!self.hot_reload_sockets.is_empty()
}
/// Sends hot reloadable changes to all clients.
pub(crate) async fn send_hotreload(&mut self, reload: HotReloadMsg) {
if reload.is_empty() {