about summary refs log tree commit diff
path: root/build.rs
blob: 05eca7ae48097319ff1cf0afd239720b9f424851 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use std::env;

fn main() {
    println!("cargo:rerun-if-changed=migrations");

    let out_dir = env::var("OUT_DIR").unwrap();

    println!("cargo:rerun-if-changed=companion-lite/");
    let companion_out = std::path::Path::new(&out_dir).join("companion");

    if let Ok(exit) = std::process::Command::new("tsc")
        .arg("--outDir")
        .arg(companion_out.as_os_str())
        .current_dir("companion-lite")
        .spawn()
        .unwrap()
        .wait()
    {
        if !exit.success() {
            std::process::exit(exit.code().unwrap_or(1))
        }
    }
    let companion_in = std::path::Path::new("companion-lite");
    for file in ["index.html", "style.css"] {
        std::fs::copy(
            companion_in.join(file),
            &companion_out.join(file)
        ).unwrap();
    }
}