add yarn install to formatting

This commit is contained in:
nora 2022-03-06 17:38:34 +01:00
parent 4f5f9d6513
commit 8070cfc2a9
4 changed files with 43 additions and 20 deletions

View file

@ -1,4 +1,8 @@
use std::path::PathBuf;
use anyhow::{ensure, Context, Result};
use std::{
path::{Path, PathBuf},
process::Command,
};
mod check_fmt;
mod codegen;
@ -43,3 +47,14 @@ pub fn project_root() -> PathBuf {
.expect("project root path")
.to_path_buf()
}
pub fn yarn_install(path: &Path) -> Result<()> {
let status = Command::new("yarn")
.arg("install")
.current_dir(path)
.status()
.context("run yarn install failed")?;
ensure!(status.success(), "Failed to build frontend");
Ok(())
}