aboutsummaryrefslogtreecommitdiff
path: root/ui/client-scripts/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ui/client-scripts/build.rs')
-rw-r--r--ui/client-scripts/build.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/ui/client-scripts/build.rs b/ui/client-scripts/build.rs
new file mode 100644
index 0000000..256fa21
--- /dev/null
+++ b/ui/client-scripts/build.rs
@@ -0,0 +1,30 @@
+/*
+ This file is part of jellything (https://codeberg.org/metamuffin/jellything)
+ which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
+ Copyright (C) 2026 metamuffin <metamuffin.org>
+*/
+#![feature(exit_status_error)]
+use std::process::{Command, Stdio};
+
+fn main() {
+ println!("cargo:rerun-if-changed=build.rs");
+ for file in glob::glob("src/**/*.ts")
+ .unwrap()
+ .map(Result::unwrap)
+ {
+ println!("cargo:rerun-if-changed={}", file.to_str().unwrap());
+ }
+ let outpath = std::env::var("OUT_DIR").unwrap();
+ // this is great :)))
+ let mut proc = Command::new("esbuild")
+ .arg("src/main.ts")
+ .arg("--bundle")
+ .arg(format!("--outfile={outpath}/bundle.js"))
+ .arg("--target=esnext")
+ .arg("--sourcemap")
+ .arg("--format=esm")
+ .stderr(Stdio::piped())
+ .spawn()
+ .unwrap();
+ proc.wait().unwrap().exit_ok().unwrap();
+}