2024-03-15 01:26:18 +05:00
|
|
|
use npm_rs::*;
|
2024-03-15 19:21:13 +05:00
|
|
|
use std::{fs, io};
|
2024-03-15 01:26:18 +05:00
|
|
|
|
|
|
|
fn main() {
|
2024-03-15 11:28:55 +05:00
|
|
|
// TODO: add cargo:rerun-if-changed for important files
|
|
|
|
|
2024-03-15 19:21:13 +05:00
|
|
|
let paths = fs::read_dir(".")
|
|
|
|
.unwrap()
|
|
|
|
.filter(|entry| entry.is_ok())
|
|
|
|
.map(|file| file.map(|e| e.path()))
|
|
|
|
.collect::<Result<Vec<_>, io::Error>>()
|
|
|
|
.unwrap();
|
|
|
|
|
|
|
|
/*for path in paths {
|
|
|
|
println!("cargo:rerun-if-changed={}", path.to_str().unwrap());
|
|
|
|
}*/
|
|
|
|
//println!("cargo:rerun-if-changed=src/main.ts");
|
|
|
|
|
2024-03-15 11:28:55 +05:00
|
|
|
NpmEnv::default()
|
2024-03-15 01:26:18 +05:00
|
|
|
.with_node_env(&NodeEnv::from_cargo_profile().unwrap_or_default())
|
|
|
|
.with_env("FOO", "bar")
|
|
|
|
.init_env()
|
|
|
|
.install(None)
|
|
|
|
.run("build")
|
2024-03-15 11:28:55 +05:00
|
|
|
.exec()
|
|
|
|
.unwrap();
|
2024-03-15 01:26:18 +05:00
|
|
|
}
|