1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use std::process::Command;
use console::style;
use emoji;
use progressbar;
pub fn cargo_install_wasm_bindgen() {
let step = format!(
"{} {}Installing WASM-bindgen...",
style("[6/7]").bold().dim(),
emoji::DOWN_ARROW
);
let pb = progressbar::new(step);
let _output = Command::new("cargo")
.arg("install")
.arg("--git")
.arg("https://github.com/alexcrichton/wasm-bindgen")
.output()
.unwrap_or_else(|e| panic!("{} failed to execute process: {}", emoji::ERROR, e));
pb.finish();
}
pub fn wasm_bindgen_build(path: &str, name: &str) {
let step = format!(
"{} {}Running WASM-bindgen...",
style("[7/7]").bold().dim(),
emoji::RUNNER
);
let pb = progressbar::new(step);
let binary_name = name.replace("-", "_");
let wasm_path = format!("target/wasm32-unknown-unknown/release/{}.wasm", binary_name);
let _output = Command::new("wasm-bindgen")
.current_dir(path)
.arg(&wasm_path)
.arg("--out-dir")
.arg("./pkg")
.output()
.unwrap_or_else(|e| panic!("{} failed to execute process: {}", emoji::ERROR, e));
pb.finish();
}