about summary refs log tree commit diff
path: root/kittybox-rs/build.rs
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2022-09-28 23:13:02 +0300
committerVika <vika@fireburn.ru>2022-09-28 23:13:02 +0300
commitc35a55babd9aa6e1ad8797f3d54deec2f78ff78a (patch)
tree742023e1d1e75601b7f7cc4020b53938e82416d8 /kittybox-rs/build.rs
parentf420c7fd09b0f9ef82784a9c49889f620e73e886 (diff)
downloadkittybox-c35a55babd9aa6e1ad8797f3d54deec2f78ff78a.tar.zst
Switch to TypeScript
This neccesitates installing TypeScript to build Kittybox, but
thankfully Nix actually takes care of that. Build Kittybox with Nix
and you won't have problems.

Also now I can safely do stuff.
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))
+        }
+    }
+}