Преглед на файлове

Merge branch 'master' into master

YuKun Liu преди 2 години
родител
ревизия
ad1ed6cfb5
променени са 4 файла, в които са добавени 20 реда и са изтрити 24 реда
  1. 4 3
      Cargo.lock
  2. 2 2
      docs/src/configure.md
  3. 0 6
      src/builder.rs
  4. 14 13
      src/cli/serve/mod.rs

+ 4 - 3
Cargo.lock

@@ -572,7 +572,7 @@ dependencies = [
  "chrono",
  "clap",
  "colored 2.0.0",
- "convert_case",
+ "convert_case", 
  "ctrlc",
  "dioxus-core",
  "dioxus-rsx",
@@ -609,7 +609,7 @@ dependencies = [
 [[package]]
 name = "dioxus-core"
 version = "0.2.1"
-source = "git+https://github.com/dioxuslabs/dioxus/#928b5358b2b56b8431be9b8f4aba8130fd45cb08"
+source = "git+https://github.com/dioxuslabs/dioxus/#f89cd204557f09febebf1afc48f418ad6ebc5254"
 dependencies = [
  "backtrace",
  "bumpalo",
@@ -621,6 +621,7 @@ dependencies = [
  "log",
  "longest-increasing-subsequence",
  "once_cell",
+ "rustc-hash",
  "serde",
  "slab",
  "smallvec",
@@ -629,7 +630,7 @@ dependencies = [
 [[package]]
 name = "dioxus-rsx"
 version = "0.0.0"
-source = "git+https://github.com/dioxuslabs/dioxus/#928b5358b2b56b8431be9b8f4aba8130fd45cb08"
+source = "git+https://github.com/dioxuslabs/dioxus/#f89cd204557f09febebf1afc48f418ad6ebc5254"
 dependencies = [
  "dioxus-core",
  "proc-macro2",

+ 2 - 2
docs/src/configure.md

@@ -25,7 +25,7 @@ We use `toml` to define some info for `dioxus` project.
    asset_dir = "public"
    ```
 
-### Application.Tool
+### Application.Tools
 
 You can combine different tools with `dioxus`.
 
@@ -168,4 +168,4 @@ style = []
 
 # Javascript code file
 script = []
-```
+```

+ 0 - 6
src/builder.rs

@@ -284,12 +284,6 @@ pub fn build_desktop(config: &CrateConfig, is_serve: bool) -> Result<()> {
     }
 
     if output.status.success() {
-        // this code will clean the output dir.
-        // if using the serve, we will not clean the out_dir.
-        if config.out_dir.is_dir() && !is_serve {
-            remove_dir_all(&config.out_dir)?;
-        }
-
         let release_type = match config.release {
             true => "release",
             false => "debug",

+ 14 - 13
src/cli/serve/mod.rs

@@ -1,5 +1,6 @@
 use super::*;
 use std::{
+    fs::create_dir_all,
     io::Write,
     path::PathBuf,
     process::{Command, Stdio},
@@ -49,7 +50,7 @@ impl Serve {
                     if cfg!(windows) {
                         file.set_extension("exe");
                     }
-                    Command::new(crate_config.out_dir.join(file).to_str().unwrap())
+                    Command::new(file.to_str().unwrap())
                         .stdout(Stdio::inherit())
                         .output()?;
                 }
@@ -71,19 +72,19 @@ impl Serve {
     pub fn regen_dev_page(crate_config: &CrateConfig) -> Result<()> {
         let serve_html = gen_page(&crate_config.dioxus_config, true);
 
-        let mut file = std::fs::File::create(
+        let dist_path = crate_config.crate_dir.join(
             crate_config
-                .crate_dir
-                .join(
-                    crate_config
-                        .dioxus_config
-                        .application
-                        .out_dir
-                        .clone()
-                        .unwrap_or_else(|| PathBuf::from("dist")),
-                )
-                .join("index.html"),
-        )?;
+                .dioxus_config
+                .application
+                .out_dir
+                .clone()
+                .unwrap_or_else(|| PathBuf::from("dist")),
+        );
+        if !dist_path.is_dir() {
+            create_dir_all(&dist_path)?;
+        }
+        let index_path = dist_path.join("index.html");
+        let mut file = std::fs::File::create(index_path)?;
         file.write_all(serve_html.as_bytes())?;
 
         Ok(())