- 1
//! Tauri codegen, plus the same stale-bundle guard `vak-server` uses. - 2
//! - 3
//! The client lives in `crates/vak-client-ui` and builds twice — `dist/` - 4
//! for this shell, `dist-web/` for the copy `vak-server` embeds under - 5
//! `/app` (docs/design/48-web-client.md). This crate ships `dist/`. - 6
//! - 7
//! `dist/` is gitignored rather than committed, so it can never be - 8
//! *shipped* stale the way the admin bundle once was — but a local `cargo - 9
//! build` after a UI edit still produces an app serving the previous - 10
//! frontend, silently. Same trap, same check. - 11
- 12
include!("../../scripts/ui_bundle_check.rs"); - 13
- 14
const UI: &str = "../vak-client-ui"; - 15
const DIST: &str = "dist"; - 16
- 17
fn main() { - 18
println!("cargo:rerun-if-changed={UI}/src"); - 19
println!("cargo:rerun-if-changed={UI}/index.html"); - 20
- 21
if let Err(problem) = check_bundle_matches_source(Path::new(UI), DIST) { - 22
let problem = format!("crates/vak-client-ui/{problem}"); - 23
// `cargo::error` is the supported way for a build script to fail the - 24
// build with a readable message; `panic!` would bury it under a - 25
// backtrace the reader does not need. - 26
println!("cargo::error={problem}"); - 27
println!("cargo::error=Run `npm run build` in crates/vak-client-ui."); - 28
std::process::exit(1); - 29
} - 30
- 31
tauri_build::build() - 32
} - 33
source · Rust
Build
crates/vak-desktop/build.rs1.3 KB33 linesSnapshot ed4ab258