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/command/generate.rs

23 lines
734 B

use crate::cache;
use crate::generate;
use crate::install::{self, Tool};
use crate::PBAR;
use anyhow::Result;
use log::info;
/// Executes the 'cargo-generate' command in the current directory
/// which generates a new rustwasm project from a template.
pub fn generate(template: String, name: String, install_permitted: bool) -> Result<()> {
info!("Generating a new rustwasm project...");
let download = install::download_prebuilt_or_cargo_install(
Tool::CargoGenerate,
&cache::get_wasm_pack_cache()?,
"latest",
install_permitted,
)?;
generate::generate(&template, &name, &download)?;
let msg = format!("🐑 Generated new project at /{}", name);
PBAR.info(&msg);
Ok(())
}