aboutsummaryrefslogtreecommitdiff
path: root/ui/client-scripts/build.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2026-01-18 23:43:12 +0100
committermetamuffin <metamuffin@disroot.org>2026-01-18 23:43:12 +0100
commited19a428cb5eef84c8cf3fed5fda3afd5fc96305 (patch)
tree39e3167a4f8b7423a15b3a5f56e973554bdb3195 /ui/client-scripts/build.rs
parent901dff07ed357694eb35284a58c3cc6c003c53ce (diff)
downloadjellything-ed19a428cb5eef84c8cf3fed5fda3afd5fc96305.tar
jellything-ed19a428cb5eef84c8cf3fed5fda3afd5fc96305.tar.bz2
jellything-ed19a428cb5eef84c8cf3fed5fda3afd5fc96305.tar.zst
Move client scripts to build-crate
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();
+}