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/main.rs

44 lines
1.2 KiB

#[macro_use]
extern crate quicli;
extern crate wasm_pack;
use quicli::prelude::*;
/// 📦 ✨ pack and publish your wasm!
#[derive(Debug, StructOpt)]
struct Cli {
#[structopt(subcommand)] // Note that we mark a field as a subcommand
cmd: Command,
/// 📝 log all the things!
#[structopt(long = "verbose", short = "v", parse(from_occurrences))]
verbosity: u8,
}
#[derive(Debug, StructOpt)]
enum Command {
#[structopt(name = "init")]
/// 🐣 initialize a package.json based on your compiled wasm
Init { path: Option<String> },
#[structopt(name = "pack")]
/// 🍱 create a tar of your npm package but don't publish!
Pack {},
#[structopt(name = "publish")]
/// 🎆 pack up your npm package and publish!
Publish {},
}
main!(|args: Cli, log_level: verbosity| match args.cmd {
Command::Init { path } => {
match path {
Some(p) => wasm_pack::write_package_json(&p)?,
None => wasm_pack::write_package_json(".")?,
}
println!("✍ wrote a package.json!");
}
Command::Pack { .. } => {
println!("🎒 packed up your package!");
}
Command::Publish { .. } => {
println!("💥 published your package!");
}
});