2021-08-22 00:14:45 -04:00
|
|
|
use std::process::Command;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let profile = std::env::var("PROFILE").unwrap();
|
|
|
|
|
2021-08-22 12:11:36 -04:00
|
|
|
let success = Command::new("npm")
|
2021-08-22 00:14:45 -04:00
|
|
|
.current_dir("./js")
|
2022-11-17 15:58:55 -05:00
|
|
|
.args(["run-script", "build"])
|
2021-08-22 00:14:45 -04:00
|
|
|
.env(
|
|
|
|
"NODE_ENV",
|
|
|
|
match profile.as_str() {
|
|
|
|
"release" => "production",
|
|
|
|
"debug" => "development",
|
|
|
|
r => panic!("Unknown release type: {}", r),
|
|
|
|
},
|
|
|
|
)
|
2021-08-22 12:11:36 -04:00
|
|
|
.spawn()
|
|
|
|
.unwrap()
|
|
|
|
.wait()
|
|
|
|
.unwrap()
|
|
|
|
.success();
|
|
|
|
|
|
|
|
if !success {
|
|
|
|
panic!("Npm build failed");
|
|
|
|
}
|
2021-08-22 00:14:45 -04:00
|
|
|
}
|