Generate webui artifacts as part of build process
This commit is contained in:
parent
14aa4a2f11
commit
6d2c32fb48
1 changed files with 21 additions and 18 deletions
|
|
@ -2,26 +2,29 @@ use std::path::Path;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let webui_dir = Path::new("webui");
|
#[cfg(feature = "webui")]
|
||||||
let webui_src_dir = webui_dir.join("src");
|
{
|
||||||
|
let webui_dir = Path::new("webui");
|
||||||
|
let webui_src_dir = webui_dir.join("src");
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed={}", webui_src_dir.to_str().unwrap());
|
println!("cargo:rerun-if-changed={}", webui_src_dir.to_str().unwrap());
|
||||||
|
|
||||||
// Run "npm run build" in the webui directory
|
// Run "npm run build" in the webui directory
|
||||||
let output = Command::new("npm")
|
let output = Command::new("npm")
|
||||||
.arg("run")
|
.arg("run")
|
||||||
.arg("build")
|
.arg("build")
|
||||||
.current_dir(webui_dir)
|
.current_dir(webui_dir)
|
||||||
.output()
|
.output()
|
||||||
.expect("Failed to execute npm run build");
|
.expect("Failed to execute npm run build");
|
||||||
|
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
panic!(
|
panic!(
|
||||||
"npm run build failed with output: {}",
|
"npm run build failed with output: {}",
|
||||||
String::from_utf8_lossy(&output.stderr)
|
String::from_utf8_lossy(&output.stderr)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optionally print the stdout output if you want to see the build logs
|
||||||
|
println!("{}", String::from_utf8_lossy(&output.stdout));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optionally print the stdout output if you want to see the build logs
|
|
||||||
println!("{}", String::from_utf8_lossy(&output.stdout));
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue