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.
![]() |
7 years ago | |
---|---|---|
.. | ||
command | 7 years ago | |
manifest | 7 years ago | |
test | 7 years ago | |
binaries.rs | 7 years ago | |
bindgen.rs | 7 years ago | |
build.rs | 7 years ago | |
child.rs | 7 years ago | |
emoji.rs | 7 years ago | |
installer.rs | 7 years ago | |
lib.rs | 7 years ago | |
lockfile.rs | 7 years ago | |
logger.rs | 7 years ago | |
main.rs | 7 years ago | |
npm.rs | 7 years ago | |
progressbar.rs | 7 years ago | |
readme.rs | 7 years ago | |
target.rs | 7 years ago |
readme.rs
//! Generating `README` files for the packaged wasm.
use failure;
use std::fs;
use std::path::Path;
use emoji;
use progressbar::Step;
use PBAR;
/// Copy the crate's README into the `pkg` directory.
pub fn copy_from_crate(path: &Path, out_dir: &Path, step: &Step) -> Result<(), failure::Error> {
assert!(
fs::metadata(path).ok().map_or(false, |m| m.is_dir()),
"crate directory should exist"
);
assert!(
fs::metadata(&out_dir).ok().map_or(false, |m| m.is_dir()),
"crate's pkg directory should exist"
);
let msg = format!("{}Copying over your README...", emoji::DANCERS);
PBAR.step(step, &msg);
let crate_readme_path = path.join("README.md");
let new_readme_path = out_dir.join("README.md");
if let Err(_) = fs::copy(&crate_readme_path, &new_readme_path) {
PBAR.warn("origin crate has no README");
};
Ok(())
}