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.
 
 
Pauan 2dd14139f5
Merge branch 'master' into find_correct_pkg
5 years ago
..
build Merge pull request #694 from Pauan/quiet 5 years ago
command refactor(tool): wasm-opt is a tool variant 5 years ago
install feat(install): wasm-opt binaries add new conditional target logic 5 years ago
manifest Merge branch 'master' into find_correct_pkg 5 years ago
test 🌥️ 0.9.0 5 years ago
bindgen.rs refactor(tool): wasm-opt is a tool variant 5 years ago
cache.rs Only print `cargo test` output the once 6 years ago
child.rs Merge branch 'master' into wasm-opt 6 years ago
emoji.rs feat(command): add generate command 6 years ago
generate.rs refactor(tool): wasm-opt is a tool variant 5 years ago
installer.rs Refactor: fix clippy warnings 6 years ago
lib.rs Merge pull request #694 from Pauan/quiet 5 years ago
license.rs More effort towards "1.0 output" goals 6 years ago
lockfile.rs Refactor: fix clippy warnings 6 years ago
main.rs Merge pull request #694 from Pauan/quiet 5 years ago
npm.rs Fix clippy warnings and add to CI 5 years ago
progressbar.rs Adding in log-level flag; also changing quiet to silence all stdout 6 years ago
readme.rs More effort towards "1.0 output" goals 6 years ago
stamps.rs fix: Rate limit version check if the request fails 6 years ago
target.rs feature(test): Add a `wasm-pack test` subcommand 7 years ago
wasm_opt.rs refactor(tool): wasm-opt is a tool variant 5 years ago

readme.rs

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

use failure::{self, ResultExt};
use std::fs;
use std::path::Path;

use PBAR;

/// Copy the crate's README into the `pkg` directory.
pub fn copy_from_crate(path: &Path, out_dir: &Path) -> 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 crate_readme_path = path.join("README.md");
let new_readme_path = out_dir.join("README.md");
if crate_readme_path.exists() {
fs::copy(&crate_readme_path, &new_readme_path).context("failed to copy README")?;
} else {
PBAR.warn("origin crate has no README");
}
Ok(())
}