1
0
Aster 3 жил өмнө
parent
commit
6271221940

+ 8 - 0
rustfmt.toml

@@ -0,0 +1,8 @@
+version = "Two"
+edition = "2018"
+
+imports_granularity = "Crate"
+#use_small_heuristics = "Max"
+#control_brace_style = "ClosingNextLine"
+normalize_comments = true
+format_code_in_doc_comments = true

+ 5 - 7
src/builder.rs

@@ -11,13 +11,11 @@ use std::{
 use wasm_bindgen_cli_support::Bindgen;
 
 pub fn build(config: &CrateConfig) -> Result<()> {
-    /*
-    [1] Build the project with cargo, generating a wasm32-unknown-unknown target (is there a more specific, better target to leverage?)
-    [2] Generate the appropriate build folders
-    [3] Wasm-bindgen the .wasm fiile, and move it into the {builddir}/modules/xxxx/xxxx_bg.wasm
-    [4] Wasm-opt the .wasm file with whatever optimizations need to be done
-    [5] Link up the html page to the wasm module
-    */
+    // [1] Build the project with cargo, generating a wasm32-unknown-unknown target (is there a more specific, better target to leverage?)
+    // [2] Generate the appropriate build folders
+    // [3] Wasm-bindgen the .wasm fiile, and move it into the {builddir}/modules/xxxx/xxxx_bg.wasm
+    // [4] Wasm-opt the .wasm file with whatever optimizations need to be done
+    // [5] Link up the html page to the wasm module
 
     let CrateConfig {
         out_dir,

+ 0 - 1
src/cli/config/mod.rs

@@ -1,6 +1,5 @@
 use super::*;
 
-
 /// Build the Rust WASM app and all of its assets.
 #[derive(Clone, Debug, Deserialize, Subcommand)]
 #[clap(name = "config")]

+ 13 - 19
src/cli/mod.rs

@@ -6,30 +6,25 @@ pub mod create;
 pub mod serve;
 pub mod translate;
 
-use crate::custom_error;
-use crate::{cfg::ConfigOptsBuild, gen_page};
-use crate::{cfg::ConfigOptsServe, server, CrateConfig};
-use crate::{error::Result, Error};
-use clap::Parser;
-use html_parser::Dom;
-use html_parser::Element;
-use html_parser::Node;
+use crate::{
+    cfg::{ConfigOptsBuild, ConfigOptsServe},
+    custom_error,
+    error::Result,
+    gen_page, server, CrateConfig, Error,
+};
+use clap::{Parser, Subcommand};
+use html_parser::{Dom, Element, Node};
 use regex::Regex;
 use serde::Deserialize;
-use std::fmt::{Display, Formatter};
-use std::fs::File;
-use std::io::Read;
-use std::process::exit;
 use std::{
-    fs::remove_dir_all,
-    process::{Command, Stdio},
+    fmt::{Display, Formatter},
+    fs::{remove_dir_all, File},
+    io::{Read, Write},
+    path::PathBuf,
+    process::{exit, Command, Stdio},
 };
-use std::{io::Write, path::PathBuf};
-use clap::{Subcommand};
 
 /// Build, bundle, & ship your Dioxus app.
-///
-///
 #[derive(Parser)]
 #[clap(name = "dioxus")]
 pub struct Cli {
@@ -39,7 +34,6 @@ pub struct Cli {
     /// Enable verbose logging.
     #[clap(short)]
     pub v: bool,
-    //
     // // note: dioxus is still roughly compatible with trunk
     // /// Path to the Trunk config file [default: Trunk.toml]
     // #[clap(long, parse(from_os_str), env = "TRUNK_CONFIG")]

+ 1 - 2
src/server/mod.rs

@@ -10,8 +10,7 @@ use notify::{RecommendedWatcher, Watcher};
 use std::{path::PathBuf, sync::Arc};
 use tower_http::services::ServeDir;
 
-use crate::Result;
-use crate::{builder, serve::Serve, CrateConfig};
+use crate::{builder, serve::Serve, CrateConfig, Result};
 use tokio::sync::broadcast;
 
 struct WsRelodState {