diff --git a/Cargo.lock b/Cargo.lock index 53c3141..69deaa2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -262,6 +262,16 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bstr" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" +dependencies = [ + "memchr", + "serde", +] + [[package]] name = "bumpalo" version = "3.15.4" @@ -333,6 +343,31 @@ dependencies = [ "libc", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" + [[package]] name = "crypto-common" version = "0.1.6" @@ -511,6 +546,7 @@ version = "0.1.0" dependencies = [ "askama", "askama_axum", + "ignore", "npm_rs", "rust-embed", ] @@ -583,6 +619,19 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +[[package]] +name = "globset" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata 0.4.6", + "regex-syntax 0.8.2", +] + [[package]] name = "h2" version = "0.4.2" @@ -728,6 +777,22 @@ dependencies = [ "cc", ] +[[package]] +name = "ignore" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" +dependencies = [ + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata 0.4.6", + "same-file", + "walkdir", + "winapi-util", +] + [[package]] name = "indexmap" version = "2.2.5" diff --git a/crates/frontend/Cargo.toml b/crates/frontend/Cargo.toml index f6d73d0..54adfd7 100644 --- a/crates/frontend/Cargo.toml +++ b/crates/frontend/Cargo.toml @@ -4,6 +4,7 @@ version = "0.1.0" edition = "2021" [build-dependencies] +ignore = "0.4.22" npm_rs = "1.0.0" [dependencies] diff --git a/crates/frontend/build.rs b/crates/frontend/build.rs index cacb5ef..502257e 100644 --- a/crates/frontend/build.rs +++ b/crates/frontend/build.rs @@ -1,24 +1,17 @@ +use ignore::Walk; use npm_rs::*; -use std::{fs, io}; fn main() { - // TODO: add cargo:rerun-if-changed for important files - - let paths = fs::read_dir(".") - .unwrap() - .filter(|entry| entry.is_ok()) - .map(|file| file.map(|e| e.path())) - .collect::, io::Error>>() - .unwrap(); - - /*for path in paths { - println!("cargo:rerun-if-changed={}", path.to_str().unwrap()); - }*/ - //println!("cargo:rerun-if-changed=src/main.ts"); + for entry in Walk::new(".") + .filter_map(Result::ok) + .filter(|e| !e.path().is_dir()) + .filter(|e| e.file_name() != "package-lock.json") + { + println!("cargo:rerun-if-changed={}", entry.path().display()); + } NpmEnv::default() .with_node_env(&NodeEnv::from_cargo_profile().unwrap_or_default()) - .with_env("FOO", "bar") .init_env() .install(None) .run("build") diff --git a/crates/frontend/src/components/Login.vue b/crates/frontend/src/components/Login.vue index b88137a..994d354 100644 --- a/crates/frontend/src/components/Login.vue +++ b/crates/frontend/src/components/Login.vue @@ -11,10 +11,8 @@ async function login() { method: "POST", headers: { "Content-Type": "application/json", - //"Access-Control-Allow-Origin": "*" }, credentials: "include", - //mode: "cors", body: JSON.stringify({ email: email.value, password: password.value }) }) .then(async response => { diff --git a/crates/frontend/src/main.ts b/crates/frontend/src/main.ts index db2971b..46e69d3 100644 --- a/crates/frontend/src/main.ts +++ b/crates/frontend/src/main.ts @@ -4,8 +4,6 @@ import router from '@/router'; import '@/assets/style.css'; -import Me from '@/views/Me.vue' -import Home from '@/views/Home.vue' createApp(App) .use(router) .mount('#app'); diff --git a/src/main.rs b/src/main.rs index 4ebb581..9c775ee 100644 --- a/src/main.rs +++ b/src/main.rs @@ -109,7 +109,7 @@ async fn home() -> impl IntoResponse { } async fn user_login() -> impl IntoResponse { - frontend::BaseTemplate { view: "signin" } + frontend::BaseTemplate { view: "app" } } async fn user(Path(user): Path) -> impl IntoResponse {}