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.
 
 
Michael Gattozzi 9ea956f216 feat(flag): add scope flag to init subcommand 7 years ago
..
bindgen.rs fix(output): refactor 7 years ago
build.rs fix(output): refactor 7 years ago
emoji.rs fix(output): refactor 7 years ago
lib.rs fix(output): refactor 7 years ago
main.rs feat(flag): add scope flag to init subcommand 7 years ago
manifest.rs feat(flag): add scope flag to init subcommand 7 years ago
progressbar.rs fix(progressbar): refactor msg into pb fn 7 years ago
readme.rs fix(readme): clear double print of readme step 7 years ago

readme.rs

use std::fs;
use failure::Error;
use console::style;
use indicatif::MultiProgress;

use progressbar;
use emoji;

pub fn copy_from_crate(path: &str) -> Result<(), Error> {
let m = MultiProgress::new();
let step = format!(
"{} {}Copying over your README...",
style("[5/7]").bold().dim(),
emoji::DANCERS
);
let pb = m.add(progressbar::new(step));
let crate_readme_path = format!("{}/README.md", path);
let new_readme_path = format!("{}/pkg/README.md", path);
if let Err(_) = fs::copy(&crate_readme_path, &new_readme_path) {
let warn = format!(
"{} {}: origin crate has no README",
emoji::WARN,
style("[WARN]").bold().dim()
);
let warn_pb = m.add(progressbar::new(warn));
warn_pb.finish();
};
pb.finish();
m.join_and_clear()?;
Ok(())
}