about summary refs log tree commit diff
path: root/kittybox-rs/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'kittybox-rs/build.rs')
-rw-r--r--kittybox-rs/build.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/kittybox-rs/build.rs b/kittybox-rs/build.rs
new file mode 100644
index 0000000..c9d6bfe
--- /dev/null
+++ b/kittybox-rs/build.rs
@@ -0,0 +1,19 @@
+fn main() {
+    use std::env;
+    let out_dir = env::var("OUT_DIR").unwrap();
+    println!("cargo:rerun-if-changed=javascript/");
+    eprintln!("Out dir: {out_dir}");
+
+    let mut child = std::process::Command::new("tsc")
+        .arg("--outDir")
+        .arg(out_dir)
+        .current_dir("javascript")
+        .spawn()
+        .unwrap();
+
+    if let Ok(exit) = child.wait() {
+        if !exit.success() {
+            std::process::exit(exit.code().unwrap_or(1))
+        }
+    }
+}