build.rs

 1use std::process::Command;
 2
 3fn main() {
 4    println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.14");
 5
 6    let output = Command::new("npm")
 7        .current_dir("../../styles")
 8        .args(["ci"])
 9        .output()
10        .expect("failed to run npm");
11    if !output.status.success() {
12        panic!(
13            "failed to install theme dependencies {}",
14            String::from_utf8_lossy(&output.stderr)
15        );
16    }
17
18    let output = Command::new("npm")
19        .current_dir("../../styles")
20        .args(["run", "build-themes"])
21        .output()
22        .expect("failed to run npm");
23    if !output.status.success() {
24        panic!(
25            "build-themes script failed {}",
26            String::from_utf8_lossy(&output.stderr)
27        );
28    }
29
30    println!("cargo:rerun-if-changed=../../styles");
31}