From 5cfa431b45a26f6520e88796367e6969738e9f5c Mon Sep 17 00:00:00 2001 From: Will Crichton Date: Wed, 22 Jun 2022 20:12:11 -0700 Subject: [PATCH] Add build script --- build.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 build.rs 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; + } +}