fork of https://github.com/rustwasm/wasm-pack for the needs of NextGraph.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
wasm-pack/src/npm.rs

32 lines
1007 B

use emoji;
use std::process::Command;
pub fn npm_pack(path: &str) {
let pkg_file_path = format!("{}/pkg", path);
let output = Command::new("npm")
.current_dir(pkg_file_path)
.arg("pack")
.output()
.unwrap_or_else(|e| panic!("{} failed to execute process: {}", emoji::ERROR, e));
if !output.status.success() {
let s = String::from_utf8_lossy(&output.stderr);
print!("{} npm_pack failed and stderr was:\n{}", emoji::ERROR, s);
}
}
pub fn npm_publish(path: &str) {
let pkg_file_path = format!("{}/pkg", path);
let output = Command::new("npm")
.current_dir(pkg_file_path)
.arg("publish")
.output()
.unwrap_or_else(|e| panic!("{} failed to execute process: {}", emoji::ERROR, e));
if !output.status.success() {
let s = String::from_utf8_lossy(&output.stderr);
print!(
"{} npm_publish failed and stderr was:\n{}",
emoji::ERROR,
s
);
}
}