aboutsummaryrefslogtreecommitdiff
path: root/server/build.rs
blob: 8b067a6e82b7fe887a4f99c1cc677ff73622a38d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use std::process::Command;

fn main() {
    println!("cargo:rerun-if-changed=build.rs");
    for file in glob::glob("../web/scripts/**/*.ts")
        .unwrap()
        .map(Result::unwrap)
    {
        println!("cargo:rerun-if-changed={}", file.to_str().unwrap());
    }
    Command::new("esbuild")
        .arg("../web/script/main.ts")
        .arg("--bundle")
        .arg(format!(
            "--outfile={}/bundle.js",
            std::env::var("OUT_DIR").unwrap()
        ))
        .arg("--target=esnext")
        .arg("--sourcemap")
        .arg("--sourcemap")
        .arg("--format=esm")
        .output()
        .unwrap();
}