diff options
author | metamuffin <metamuffin@disroot.org> | 2024-06-04 16:48:07 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-06-04 16:48:07 +0200 |
commit | 34967cd3b6530656ef0bf31810f9fd6dfb853765 (patch) | |
tree | 912bb0995db6997b601f246cfb0420b6b3ab2101 /build.rs | |
parent | ce0b808a01081322abc7ed51e09d0f452b606ad7 (diff) | |
download | gpn-tron-rust-34967cd3b6530656ef0bf31810f9fd6dfb853765.tar gpn-tron-rust-34967cd3b6530656ef0bf31810f9fd6dfb853765.tar.bz2 gpn-tron-rust-34967cd3b6530656ef0bf31810f9fd6dfb853765.tar.zst |
can vie games
Diffstat (limited to 'build.rs')
-rw-r--r-- | build.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..8255656 --- /dev/null +++ b/build.rs @@ -0,0 +1,21 @@ +#![feature(exit_status_error)] +use std::process::{Command, Stdio}; + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-changed=src/spectate/main.ts"); + let outpath = std::env::var("OUT_DIR").unwrap(); + // this is great :))) + println!("cargo:warning=\r\x1b[32m\x1b[1m Bundle\x1b[0m writing main.js ({outpath})"); + let mut proc = Command::new("esbuild") + .arg("src/spectate/main.ts") + .arg("--bundle") + .arg(format!("--outfile={outpath}/main.js")) + .arg("--target=esnext") + .arg("--sourcemap") + .arg("--format=esm") + .stderr(Stdio::piped()) + .spawn() + .unwrap(); + proc.wait().unwrap().exit_ok().unwrap(); +} |