/* 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) 2024 metamuffin */ #![feature(exit_status_error)] use std::process::{Command, Stdio}; fn main() { println!("cargo:rerun-if-changed=build.rs"); for file in glob::glob("../web/script/**/*.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 :))) println!("cargo:warning=\r\x1b[32m\x1b[1m Bundle\x1b[0m writing bundle.js ({outpath})"); let mut proc = Command::new("esbuild") .arg("../web/script/main.ts") .arg("--bundle") .arg(format!("--outfile={outpath}/bundle.js")) .arg("--target=esnext") .arg("--sourcemap") .arg("--sourcemap") .arg("--format=esm") .stderr(Stdio::piped()) .spawn() .unwrap(); proc.wait().unwrap().exit_ok().unwrap(); }