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