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 73ed2b83f7
Update mod.rs
6 years ago
..
command Update mod.rs 6 years ago
manifest tests: Port all of our tests to use `assert_cmd` 6 years ago
test Update chromedriver to v0.46 and geckodriver to v0.24.0 6 years ago
bindgen.rs Fix directory layout of cached `cargo install`ed wasm-bindgens 6 years ago
build.rs Add back building tests 6 years ago
cache.rs Only print `cargo test` output the once 6 years ago
child.rs Replace `slog` with `log` 6 years ago
emoji.rs fix(build): rustc check emoji and fix 7 years ago
installer.rs refactor: Import self and use full module path for failure 7 years ago
lib.rs Only print `cargo test` output the once 6 years ago
license.rs be aware of license-file field as source of license 6 years ago
lockfile.rs Fix wasm-bindgen if lib is renamed via `lib.name` 7 years ago
main.rs Replace `slog` with `log` 6 years ago
npm.rs Replace `slog` with `log` 6 years ago
progressbar.rs Only print `cargo test` output the once 6 years ago
readme.rs chore: Run rustfmt 7 years ago
target.rs feature(test): Add a `wasm-pack test` subcommand 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(())
}