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.
 
 
ashley williams 2ef929dc91
Merge pull request #282 from mstallmo/add-otp-to-publish
7 years ago
..
command Merge pull request #263 from xmclark/cli-pkg-dir 7 years ago
bindgen.rs Add listing for precompiled Windows binaries 7 years ago
build.rs Use PathBuf instead of String to handle paths 7 years ago
emoji.rs Deny missing documentation 7 years ago
error.rs feature: Use pre-built `wasm-bindgen` CLIs from Github releases 7 years ago
lib.rs feature: Use pre-built `wasm-bindgen` CLIs from Github releases 7 years ago
logger.rs rustfmt: Re run `cargo fmt` for new nightly 7 years ago
main.rs tidy: Use `Fail::iter_causes` instead of `e.causes().skip(1)` 7 years ago
manifest.rs Provide single quote separators around missing Cargo.toml field to improve readability 7 years ago
npm.rs add support for otp when publishing to npm 7 years ago
progressbar.rs Deny missing documentation 7 years ago
readme.rs add out dir cli parameter 7 years ago

readme.rs

//! Generating `README` files for the packaged wasm.

use error::Error;
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<(), 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(())
}