-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.rs
More file actions
33 lines (28 loc) · 1.05 KB
/
build.rs
File metadata and controls
33 lines (28 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use std::process::Command;
fn main() {
let profile = std::env::var("PROFILE").unwrap_or_default();
if profile != "release" && profile != "dist" {
return;
}
// Skip build.rs in CI environments since it's handled by build-setup.yml
if std::env::var("CI").is_ok() || std::env::var("GITHUB_ACTIONS").is_ok() {
println!("cargo:warning=Skipping web build in CI environment");
return;
}
println!("cargo:rerun-if-changed=web/package.json");
println!("cargo:rerun-if-changed=web/package-lock.json");
println!("cargo:rerun-if-changed=web/vite.config.ts");
println!("cargo:rerun-if-changed=web/src");
let status = Command::new("npm")
.args(["ci"])
.current_dir("web")
.status()
.expect("failed to run npm ci");
assert!(status.success(), "npm ci failed");
let status = Command::new("npm")
.args(["run", "build"])
.current_dir("web")
.status()
.expect("failed to run npm run build");
assert!(status.success(), "npm run build failed");
}