Explorar o código

feat: commit prettier_build

YuKun Liu %!s(int64=3) %!d(string=hai) anos
pai
achega
78c78548e8
Modificáronse 2 ficheiros con 26 adicións e 18 borrados
  1. 1 1
      src/builder.rs
  2. 25 17
      src/server/mod.rs

+ 1 - 1
src/builder.rs

@@ -368,7 +368,7 @@ fn prettier_build(mut cmd: Command) -> anyhow::Result<Vec<Diagnostic>> {
             Message::BuildFinished(finished) => {
                 if finished.success {
                     pb.finish_and_clear();
-                    println!("Done in");
+                    log::info!("Build done.");
                 } else {
                     std::process::exit(1);
                 }

+ 25 - 17
src/server/mod.rs

@@ -342,7 +342,7 @@ pub async fn startup_default(port: u16, config: CrateConfig) -> Result<()> {
             elapsed_time: first_build_result.elapsed_time,
         },
     );
-    
+
     let file_service_config = config.clone();
     let file_service = ServiceBuilder::new()
         .and_then(
@@ -434,18 +434,6 @@ fn print_console_info(port: u16, config: &CrateConfig, options: PrettierOptions)
         profile = config.custom_profile.as_ref().unwrap().to_string();
     }
     let hot_reload = if config.hot_reload { "RSX" } else { "Normal" };
-    let tools_str = format!(
-        "{:?}",
-        config
-            .dioxus_config
-            .application
-            .tools
-            .clone()
-            .unwrap_or_default()
-            .iter()
-            .map(|d| d.0.clone())
-            .collect::<Vec<String>>()
-    );
     let crate_root = crate::cargo::crate_root().unwrap();
     let custom_html_file = if crate_root.join("index.html").is_file() {
         "Custom [index.html]"
@@ -494,15 +482,35 @@ fn print_console_info(port: u16, config: &CrateConfig, options: PrettierOptions)
     println!("");
     println!("\t> Profile : {}", profile.green());
     println!("\t> Hot Reload : {}", hot_reload.cyan());
-    println!("\t> Enabled Tools : {}", tools_str.yellow());
     println!("\t> Index Template : {}", custom_html_file.green());
     println!("\t> URL Rewrite [index_on_404] : {}", url_rewrite.purple());
     println!("");
+    println!(
+        "\t> Build Time Use : {} millis",
+        options.elapsed_time.to_string().green().bold()
+    );
+    println!("");
 
-    if options.changed.len() <= 0 {
-        log::info!("{}", "Server startup completed.".green().bold());
+    if options.warnings.len() == 0 {
+        log::info!("{}\n", "A perfect compilation!".green().bold());
     } else {
-        log::info!("{}", "Project rebuild completed.".green().bold());
+        log::warn!(
+            "{}\n",
+            format!(
+                "There were {} warning messages during the build: ",
+                options.warnings.len() - 1
+            )
+            .yellow()
+            .bold()
+        );
+        for info in &options.warnings {
+            if info.message == format!("{} warnings emitted", options.warnings.len() - 1) {
+                continue;
+            }
+            if let Some(val) = info.rendered.clone() {
+                log::warn!("{}", val);
+            }
+        }
     }
 }