diff --git a/Cargo.lock b/Cargo.lock index e9dfa0b1..ffca5cd6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -573,6 +573,7 @@ dependencies = [ "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "ws 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "yansi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3557,6 +3558,11 @@ name = "yansi" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "yansi" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[patch.unused]] name = "js-sys" version = "0.3.5" @@ -3953,3 +3959,4 @@ source = "git+http://github.com/tcr/wasm-bindgen?rev=90193ea#90193eab51aee29a558 "checksum ws 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "329d3e6dd450a9c5c73024e1047f0be7e24121a68484eb0b5368977bee3cf8c3" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum yansi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a503e4eea629f145a693c8ed1eddba88b3b9de5171c6ebd0e2820cf82d38f934" +"checksum yansi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71" diff --git a/build-tools/src/main.rs b/build-tools/src/main.rs index 0adef00a..0806efa3 100644 --- a/build-tools/src/main.rs +++ b/build-tools/src/main.rs @@ -547,22 +547,6 @@ fn run() -> Result<(), Error> { println!("Database path: edit-server/edit.sqlite3"); } - // Build dist folder if it doesn't exist. - if !Path::new("edit-frontend/dist/edit.js").exists() { - execute!( - r" - {self_path} wasm-build - ", - self_path = SELF_PATH, - )?; - execute!( - r" - {self_path} frontend-build - ", - self_path = SELF_PATH, - )?; - } - eprintln!("Starting server..."); let release_flag = if release { Some("--release") } else { None }; @@ -590,22 +574,6 @@ fn run() -> Result<(), Error> { Cli::ServerBuild { args } => { let release_flag = if release { Some("--release") } else { None }; - // Build dist folder if it doesn't exist. - if !Path::new("edit-frontend/dist/edit.js").exists() { - execute!( - r" - {self_path} wasm-build - ", - self_path = SELF_PATH, - )?; - execute!( - r" - {self_path} frontend-build - ", - self_path = SELF_PATH, - )?; - } - execute!( r" cd edit-server diff --git a/edit-server/Cargo.toml b/edit-server/Cargo.toml index 8b36cbc0..86b34e75 100644 --- a/edit-server/Cargo.toml +++ b/edit-server/Cargo.toml @@ -36,6 +36,7 @@ take_mut = "0.2.0" taken = "0.1.1" url = "1.6.0" ws = "0.7.3" +yansi = "0.5" [dependencies.diesel] features = ["sqlite"] diff --git a/edit-server/src/bin/edit-server.rs b/edit-server/src/bin/edit-server.rs index 5e15358d..5a9d72d3 100644 --- a/edit-server/src/bin/edit-server.rs +++ b/edit-server/src/bin/edit-server.rs @@ -16,6 +16,7 @@ use md5; use reqwest; use crypto::md5::Md5; use crypto::digest::Digest; +use yansi::Paint; #[macro_use] extern crate serde_json; @@ -184,6 +185,18 @@ fn run_http_server(port: u16, client_proxy: bool) { assert!(template_dir.exists(Path::new("presentation.hbs"))); assert!(template_dir.exists(Path::new("favicon.png"))); + // Build dist folder if it doesn't exist. + if dist_dir.get(Path::new("edit.js")).is_none() { + eprintln!("{}", Paint::yellow(r" +======================================================= + WARNING! + The file edit-frontend/dist/edit.js does not exist. + You should generate the frontend code by running + `./tools frontend-build` from a terminal window. +======================================================= +")); + } + println!( "> Server listening for HTTP connections on http://0.0.0.0:{}/", port