xtask/
update_vite_example.rs1use std::process::Command;
2
3use anyhow::{bail, Result};
4
5pub fn run() -> Result<()> {
6 let langs = crate::LANGUAGE_CONFIG
7 .languages
8 .iter()
9 .filter(|lang| lang.wasm)
10 .map(|lang| &lang.name)
11 .collect::<Vec<_>>();
12 let demo_dir = crate::WORKSPACE_DIR.join("examples/wasm/vite");
13 let status = Command::new("npm")
14 .current_dir(&demo_dir)
15 .arg("install")
16 .args(langs.iter().map(|lang| format!("@syntastica/lang-{lang}")))
17 .status()?;
18 if !status.success() {
19 bail!("npm exited with non-zero exit code: {status}");
20 }
21
22 Ok(())
23}