diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..901c991 --- /dev/null +++ b/build.rs @@ -0,0 +1,27 @@ +use std::{path::Path, process::Command}; + +const JS_DIST_DIR: &str = "js/dist"; + +fn main() { + if !Path::new(JS_DIST_DIR).exists() { + let status = Command::new("pnpm") + .current_dir("js") + .arg("install") + .status() + .unwrap(); + if !status.success() { + panic!("Failed to install JS deps") + } + + let status = Command::new("pnpm") + .current_dir("js") + .arg("build") + .status() + .unwrap(); + if !status.success() { + panic!("Failed to build JS"); + } + + return; + } +}