diff --git a/vdev/src/commands/compile_vrl_wasm.rs b/vdev/src/commands/compile_vrl_wasm.rs index ef5a5d9412fc4..2ff7dfc096d5b 100644 --- a/vdev/src/commands/compile_vrl_wasm.rs +++ b/vdev/src/commands/compile_vrl_wasm.rs @@ -11,23 +11,15 @@ pub struct Cli {} impl Cli { pub fn exec(self) -> Result<()> { + let crates = vec!["compiler", "core", "diagnostic", "parser"]; let vrl_path = Path::new(app::path()).join("lib").join("vrl"); let args = vec!["build", "--release", "--target", "wasm32-unknown-unknown"]; - println!("Compiling lib/vrl/compiler to wasm32-unknown-unknown"); - std::env::set_current_dir(vrl_path.join("compiler"))?; - app::exec("cargo", &args, false)?; - println!("Compiling lib/vrl/core to wasm32-unknown-unknown"); - std::env::set_current_dir(vrl_path.join("core"))?; - app::exec("cargo", &args, false)?; - - println!("Compiling lib/vrl/diagnostic to wasm32-unknown-unknown"); - std::env::set_current_dir(vrl_path.join("diagnostic"))?; - app::exec("cargo", &args, false)?; - - println!("Compiling lib/vrl/parser to wasm32-unknown-unknown"); - std::env::set_current_dir(vrl_path.join("parser"))?; - app::exec("cargo", &args, false)?; + for crate_name in crates { + println!("Compiling lib/vrl/{crate_name} to wasm32-unknown-unknown"); + std::env::set_current_dir(vrl_path.join(crate_name))?; + app::exec("cargo", &args, false)?; + } Ok(()) } }