initial support for --out-name added

master
ibaryshnikov 6 years ago
parent ef745bfdcf
commit 7a96d8d754
  1. 10
      docs/src/commands/build.md
  2. 5
      src/bindgen.rs
  3. 10
      src/command/build.rs
  4. 2
      src/command/test.rs
  5. 22
      src/manifest/mod.rs
  6. 10
      tests/all/license.rs
  7. 8
      tests/all/lockfile.rs
  8. 36
      tests/all/manifest.rs

@ -32,6 +32,16 @@ wasm-pack build --out-dir out
The above command will put your build artifacts in a directory called `out`, instead The above command will put your build artifacts in a directory called `out`, instead
of the default `pkg`. of the default `pkg`.
## Output file names
Set output file names. Defaults to package name.
```
wasm-pack build --out-name index
```
This command will build the package with file names like `index.js`, `index.d.ts`, and so on.
## Profile ## Profile
The `build` command accepts an optional profile argument: one of `--dev`, The `build` command accepts an optional profile argument: one of `--dev`,

@ -173,6 +173,7 @@ pub fn wasm_bindgen_build(
data: &CrateData, data: &CrateData,
bindgen: &Download, bindgen: &Download,
out_dir: &Path, out_dir: &Path,
out_name: &Option<String>,
disable_dts: bool, disable_dts: bool,
target: &Target, target: &Target,
profile: BuildProfile, profile: BuildProfile,
@ -210,6 +211,10 @@ pub fn wasm_bindgen_build(
.arg(dts_arg) .arg(dts_arg)
.arg(target_arg); .arg(target_arg);
if let Some(value) = out_name {
cmd.arg("--out-name").arg(value);
}
let profile = data.configured_profile(profile); let profile = data.configured_profile(profile);
if profile.wasm_bindgen_debug_js_glue() { if profile.wasm_bindgen_debug_js_glue() {
cmd.arg("--debug"); cmd.arg("--debug");

@ -28,6 +28,7 @@ pub struct Build {
pub profile: BuildProfile, pub profile: BuildProfile,
pub mode: BuildMode, pub mode: BuildMode,
pub out_dir: PathBuf, pub out_dir: PathBuf,
pub out_name: Option<String>,
pub bindgen: Option<Download>, pub bindgen: Option<Download>,
pub cache: Cache, pub cache: Cache,
pub extra_options: Vec<String>, pub extra_options: Vec<String>,
@ -159,6 +160,10 @@ pub struct BuildOptions {
/// Sets the output directory with a relative path. /// Sets the output directory with a relative path.
pub out_dir: String, pub out_dir: String,
#[structopt(long = "out-name")]
/// Sets the output file names. Defaults to package name.
pub out_name: Option<String>,
#[structopt(last = true)] #[structopt(last = true)]
/// List of extra options to pass to `cargo build` /// List of extra options to pass to `cargo build`
pub extra_options: Vec<String>, pub extra_options: Vec<String>,
@ -177,6 +182,7 @@ impl Default for BuildOptions {
release: false, release: false,
profiling: false, profiling: false,
out_dir: String::new(), out_dir: String::new(),
out_name: None,
extra_options: Vec::new(), extra_options: Vec::new(),
} }
} }
@ -188,7 +194,7 @@ impl Build {
/// Construct a build command from the given options. /// Construct a build command from the given options.
pub fn try_from_opts(build_opts: BuildOptions) -> Result<Self, Error> { pub fn try_from_opts(build_opts: BuildOptions) -> Result<Self, Error> {
let crate_path = set_crate_path(build_opts.path)?; let crate_path = set_crate_path(build_opts.path)?;
let crate_data = manifest::CrateData::new(&crate_path)?; let crate_data = manifest::CrateData::new(&crate_path, build_opts.out_name.clone())?;
let out_dir = crate_path.join(PathBuf::from(build_opts.out_dir)); let out_dir = crate_path.join(PathBuf::from(build_opts.out_dir));
let dev = build_opts.dev || build_opts.debug; let dev = build_opts.dev || build_opts.debug;
@ -210,6 +216,7 @@ impl Build {
profile, profile,
mode: build_opts.mode, mode: build_opts.mode,
out_dir, out_dir,
out_name: build_opts.out_name,
bindgen: None, bindgen: None,
cache: cache::get_wasm_pack_cache()?, cache: cache::get_wasm_pack_cache()?,
extra_options: build_opts.extra_options, extra_options: build_opts.extra_options,
@ -388,6 +395,7 @@ impl Build {
&self.crate_data, &self.crate_data,
self.bindgen.as_ref().unwrap(), self.bindgen.as_ref().unwrap(),
&self.out_dir, &self.out_dir,
&self.out_name,
self.disable_dts, self.disable_dts,
&self.target, &self.target,
self.profile, self.profile,

@ -120,7 +120,7 @@ impl Test {
} = test_opts; } = test_opts;
let crate_path = set_crate_path(path)?; let crate_path = set_crate_path(path)?;
let crate_data = manifest::CrateData::new(&crate_path)?; let crate_data = manifest::CrateData::new(&crate_path, None)?;
let any_browser = chrome || firefox || safari; let any_browser = chrome || firefox || safari;
if !node && !any_browser { if !node && !any_browser {

@ -27,6 +27,7 @@ pub struct CrateData {
data: Metadata, data: Metadata,
current_idx: usize, current_idx: usize,
manifest: CargoManifest, manifest: CargoManifest,
out_name: Option<String>,
} }
#[doc(hidden)] #[doc(hidden)]
@ -214,7 +215,7 @@ pub struct ManifestAndUnsedKeys {
impl CrateData { impl CrateData {
/// Reads all metadata for the crate whose manifest is inside the directory /// Reads all metadata for the crate whose manifest is inside the directory
/// specified by `path`. /// specified by `path`.
pub fn new(crate_path: &Path) -> Result<CrateData, Error> { pub fn new(crate_path: &Path, out_name: Option<String>) -> Result<CrateData, Error> {
let manifest_path = crate_path.join("Cargo.toml"); let manifest_path = crate_path.join("Cargo.toml");
if !manifest_path.is_file() { if !manifest_path.is_file() {
bail!( bail!(
@ -241,6 +242,7 @@ impl CrateData {
data, data,
manifest, manifest,
current_idx, current_idx,
out_name,
}); });
fn error_chain_to_failure(err: cargo_metadata::Error) -> Error { fn error_chain_to_failure(err: cargo_metadata::Error) -> Error {
@ -346,6 +348,14 @@ impl CrateData {
} }
} }
/// Get the prefix for output file names
fn name_prefix(&self) -> String {
match &self.out_name {
Some(value) => value.clone(),
None => self.crate_name(),
}
}
/// Get the license for the crate at the given path. /// Get the license for the crate at the given path.
pub fn crate_license(&self) -> &Option<String> { pub fn crate_license(&self) -> &Option<String> {
&self.manifest.package.license &self.manifest.package.license
@ -396,14 +406,14 @@ impl CrateData {
disable_dts: bool, disable_dts: bool,
out_dir: &Path, out_dir: &Path,
) -> NpmData { ) -> NpmData {
let crate_name = self.crate_name(); let name_prefix = self.name_prefix();
let wasm_file = format!("{}_bg.wasm", crate_name); let wasm_file = format!("{}_bg.wasm", name_prefix);
let js_file = format!("{}.js", crate_name); let js_file = format!("{}.js", name_prefix);
let mut files = vec![wasm_file]; let mut files = vec![wasm_file];
files.push(js_file.clone()); files.push(js_file.clone());
if include_commonjs_shim { if include_commonjs_shim {
let js_bg_file = format!("{}_bg.js", crate_name); let js_bg_file = format!("{}_bg.js", name_prefix);
files.push(js_bg_file.to_string()); files.push(js_bg_file.to_string());
} }
@ -414,7 +424,7 @@ impl CrateData {
}; };
let dts_file = if !disable_dts { let dts_file = if !disable_dts {
let file = format!("{}.d.ts", crate_name); let file = format!("{}.d.ts", name_prefix);
files.push(file.to_string()); files.push(file.to_string());
Some(file) Some(file)
} else { } else {

@ -12,7 +12,7 @@ fn it_copies_a_license_default_path() {
let fixture = fixture::single_license(); let fixture = fixture::single_license();
let out_dir = fixture.path.join("pkg"); let out_dir = fixture.path.join("pkg");
fs::create_dir(&out_dir).expect("should create pkg directory OK"); fs::create_dir(&out_dir).expect("should create pkg directory OK");
let crate_data = CrateData::new(&fixture.path); let crate_data = CrateData::new(&fixture.path, None);
assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir).is_ok()); assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir).is_ok());
@ -37,7 +37,7 @@ fn it_copies_a_license_provided_path() {
let fixture = fixture::single_license(); let fixture = fixture::single_license();
let out_dir = fixture.path.join("pkg"); let out_dir = fixture.path.join("pkg");
fs::create_dir(&out_dir).expect("should create pkg directory OK"); fs::create_dir(&out_dir).expect("should create pkg directory OK");
let crate_data = CrateData::new(&fixture.path); let crate_data = CrateData::new(&fixture.path, None);
assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir).is_ok()); assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir).is_ok());
let crate_license_path = fixture.path.join("LICENSE"); let crate_license_path = fixture.path.join("LICENSE");
@ -60,7 +60,7 @@ fn it_copies_all_licenses_default_path() {
let fixture = fixture::dual_license(); let fixture = fixture::dual_license();
let out_dir = fixture.path.join("pkg"); let out_dir = fixture.path.join("pkg");
fs::create_dir(&out_dir).expect("should create pkg directory OK"); fs::create_dir(&out_dir).expect("should create pkg directory OK");
let crate_data = CrateData::new(&fixture.path); let crate_data = CrateData::new(&fixture.path, None);
assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir).is_ok()); assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir).is_ok());
@ -95,7 +95,7 @@ fn it_copies_all_licenses_provided_path() {
let fixture = fixture::dual_license(); let fixture = fixture::dual_license();
let out_dir = fixture.path.join("pkg"); let out_dir = fixture.path.join("pkg");
fs::create_dir(&out_dir).expect("should create pkg directory OK"); fs::create_dir(&out_dir).expect("should create pkg directory OK");
let crate_data = CrateData::new(&fixture.path); let crate_data = CrateData::new(&fixture.path, None);
assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir).is_ok()); assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir).is_ok());
@ -131,7 +131,7 @@ fn it_copies_a_non_standard_license_provided_path() {
let fixture = fixture::non_standard_license(license_file); let fixture = fixture::non_standard_license(license_file);
let out_dir = fixture.path.join("pkg"); let out_dir = fixture.path.join("pkg");
fs::create_dir(&out_dir).expect("should create pkg directory OK"); fs::create_dir(&out_dir).expect("should create pkg directory OK");
let crate_data = CrateData::new(&fixture.path); let crate_data = CrateData::new(&fixture.path, None);
assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir).is_ok()); assert!(license::copy_from_crate(&crate_data.unwrap(), &fixture.path, &out_dir).is_ok());

@ -6,7 +6,7 @@ use wasm_pack::manifest::CrateData;
fn it_gets_wasm_bindgen_version() { fn it_gets_wasm_bindgen_version() {
let fixture = fixture::js_hello_world(); let fixture = fixture::js_hello_world();
fixture.cargo_check(); fixture.cargo_check();
let data = CrateData::new(&fixture.path).unwrap(); let data = CrateData::new(&fixture.path, None).unwrap();
let lock = Lockfile::new(&data).unwrap(); let lock = Lockfile::new(&data).unwrap();
assert_eq!(lock.wasm_bindgen_version(), Some("0.2.37"),); assert_eq!(lock.wasm_bindgen_version(), Some("0.2.37"),);
} }
@ -15,7 +15,7 @@ fn it_gets_wasm_bindgen_version() {
fn it_gets_wasm_bindgen_test_version() { fn it_gets_wasm_bindgen_test_version() {
let fixture = fixture::wbg_test_node(); let fixture = fixture::wbg_test_node();
fixture.cargo_check(); fixture.cargo_check();
let data = CrateData::new(&fixture.path).unwrap(); let data = CrateData::new(&fixture.path, None).unwrap();
let lock = Lockfile::new(&data).unwrap(); let lock = Lockfile::new(&data).unwrap();
assert_eq!(lock.wasm_bindgen_test_version(), Some("0.2.37"),); assert_eq!(lock.wasm_bindgen_test_version(), Some("0.2.37"),);
} }
@ -60,7 +60,7 @@ fn it_gets_wasm_bindgen_version_in_crate_inside_workspace() {
"#, "#,
); );
fixture.cargo_check(); fixture.cargo_check();
let data = CrateData::new(&fixture.path.join("blah")).unwrap(); let data = CrateData::new(&fixture.path.join("blah"), None).unwrap();
let lock = Lockfile::new(&data).unwrap(); let lock = Lockfile::new(&data).unwrap();
assert_eq!(lock.wasm_bindgen_version(), Some("0.2.37"),); assert_eq!(lock.wasm_bindgen_version(), Some("0.2.37"),);
} }
@ -128,7 +128,7 @@ fn it_gets_wasm_bindgen_version_from_dependencies() {
"#, "#,
); );
fixture.cargo_check(); fixture.cargo_check();
let data = CrateData::new(&fixture.path.join("parent")).unwrap(); let data = CrateData::new(&fixture.path.join("parent"), None).unwrap();
let lock = Lockfile::new(&data).unwrap(); let lock = Lockfile::new(&data).unwrap();
assert_eq!(lock.wasm_bindgen_version(), Some("0.2.37"),); assert_eq!(lock.wasm_bindgen_version(), Some("0.2.37"),);
} }

@ -9,7 +9,7 @@ use wasm_pack::{self, license, manifest};
#[test] #[test]
fn it_gets_the_crate_name_default_path() { fn it_gets_the_crate_name_default_path() {
let path = &PathBuf::from("."); let path = &PathBuf::from(".");
let crate_data = manifest::CrateData::new(&path).unwrap(); let crate_data = manifest::CrateData::new(&path, None).unwrap();
let name = crate_data.crate_name(); let name = crate_data.crate_name();
assert_eq!(name, "wasm_pack"); assert_eq!(name, "wasm_pack");
} }
@ -17,7 +17,7 @@ fn it_gets_the_crate_name_default_path() {
#[test] #[test]
fn it_gets_the_crate_name_provided_path() { fn it_gets_the_crate_name_provided_path() {
let fixture = fixture::js_hello_world(); let fixture = fixture::js_hello_world();
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
assert_eq!(crate_data.crate_name(), "js_hello_world"); assert_eq!(crate_data.crate_name(), "js_hello_world");
} }
@ -26,7 +26,7 @@ fn it_checks_has_cdylib_default_path() {
let fixture = fixture::no_cdylib(); let fixture = fixture::no_cdylib();
// Ensure that there is a `Cargo.lock`. // Ensure that there is a `Cargo.lock`.
fixture.cargo_check(); fixture.cargo_check();
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
assert!(crate_data.check_crate_config().is_err()); assert!(crate_data.check_crate_config().is_err());
} }
@ -35,14 +35,14 @@ fn it_checks_has_cdylib_provided_path() {
let fixture = fixture::js_hello_world(); let fixture = fixture::js_hello_world();
// Ensure that there is a `Cargo.lock`. // Ensure that there is a `Cargo.lock`.
fixture.cargo_check(); fixture.cargo_check();
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
crate_data.check_crate_config().unwrap(); crate_data.check_crate_config().unwrap();
} }
#[test] #[test]
fn it_checks_has_cdylib_wrong_crate_type() { fn it_checks_has_cdylib_wrong_crate_type() {
let fixture = fixture::bad_cargo_toml(); let fixture = fixture::bad_cargo_toml();
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
assert!(crate_data.check_crate_config().is_err()); assert!(crate_data.check_crate_config().is_err());
} }
@ -51,7 +51,7 @@ fn it_recognizes_a_map_during_depcheck() {
let fixture = fixture::serde_feature(); let fixture = fixture::serde_feature();
// Ensure that there is a `Cargo.lock`. // Ensure that there is a `Cargo.lock`.
fixture.cargo_check(); fixture.cargo_check();
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
crate_data.check_crate_config().unwrap(); crate_data.check_crate_config().unwrap();
} }
@ -59,7 +59,7 @@ fn it_recognizes_a_map_during_depcheck() {
fn it_creates_a_package_json_default_path() { fn it_creates_a_package_json_default_path() {
let fixture = fixture::js_hello_world(); let fixture = fixture::js_hello_world();
let out_dir = fixture.path.join("pkg"); let out_dir = fixture.path.join("pkg");
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap();
assert!(crate_data assert!(crate_data
.write_package_json(&out_dir, &None, false, &Target::Bundler) .write_package_json(&out_dir, &None, false, &Target::Bundler)
@ -94,7 +94,7 @@ fn it_creates_a_package_json_default_path() {
fn it_creates_a_package_json_provided_path() { fn it_creates_a_package_json_provided_path() {
let fixture = fixture::js_hello_world(); let fixture = fixture::js_hello_world();
let out_dir = fixture.path.join("pkg"); let out_dir = fixture.path.join("pkg");
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap();
assert!(crate_data assert!(crate_data
.write_package_json(&out_dir, &None, false, &Target::Bundler) .write_package_json(&out_dir, &None, false, &Target::Bundler)
@ -122,7 +122,7 @@ fn it_creates_a_package_json_provided_path() {
fn it_creates_a_package_json_provided_path_with_scope() { fn it_creates_a_package_json_provided_path_with_scope() {
let fixture = fixture::js_hello_world(); let fixture = fixture::js_hello_world();
let out_dir = fixture.path.join("pkg"); let out_dir = fixture.path.join("pkg");
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap();
assert!(crate_data assert!(crate_data
.write_package_json(&out_dir, &Some("test".to_string()), false, &Target::Bundler,) .write_package_json(&out_dir, &Some("test".to_string()), false, &Target::Bundler,)
@ -150,7 +150,7 @@ fn it_creates_a_package_json_provided_path_with_scope() {
fn it_creates_a_pkg_json_with_correct_files_on_node() { fn it_creates_a_pkg_json_with_correct_files_on_node() {
let fixture = fixture::js_hello_world(); let fixture = fixture::js_hello_world();
let out_dir = fixture.path.join("pkg"); let out_dir = fixture.path.join("pkg");
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap();
assert!(crate_data assert!(crate_data
.write_package_json(&out_dir, &None, false, &Target::Nodejs) .write_package_json(&out_dir, &None, false, &Target::Nodejs)
@ -185,7 +185,7 @@ fn it_creates_a_pkg_json_with_correct_files_on_node() {
fn it_creates_a_pkg_json_with_correct_files_on_nomodules() { fn it_creates_a_pkg_json_with_correct_files_on_nomodules() {
let fixture = fixture::js_hello_world(); let fixture = fixture::js_hello_world();
let out_dir = fixture.path.join("pkg"); let out_dir = fixture.path.join("pkg");
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap();
assert!(crate_data assert!(crate_data
.write_package_json(&out_dir, &None, false, &Target::NoModules) .write_package_json(&out_dir, &None, false, &Target::NoModules)
@ -219,7 +219,7 @@ fn it_creates_a_pkg_json_with_correct_files_on_nomodules() {
fn it_creates_a_pkg_json_in_out_dir() { fn it_creates_a_pkg_json_in_out_dir() {
let fixture = fixture::js_hello_world(); let fixture = fixture::js_hello_world();
let out_dir = fixture.path.join("./custom/out"); let out_dir = fixture.path.join("./custom/out");
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap();
assert!(crate_data assert!(crate_data
.write_package_json(&out_dir, &None, false, &Target::Bundler) .write_package_json(&out_dir, &None, false, &Target::Bundler)
@ -234,7 +234,7 @@ fn it_creates_a_pkg_json_in_out_dir() {
fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() { fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() {
let fixture = fixture::js_hello_world(); let fixture = fixture::js_hello_world();
let out_dir = fixture.path.join("pkg"); let out_dir = fixture.path.join("pkg");
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap();
assert!(crate_data assert!(crate_data
.write_package_json(&out_dir, &None, true, &Target::Bundler) .write_package_json(&out_dir, &None, true, &Target::Bundler)
@ -262,7 +262,7 @@ fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() {
#[test] #[test]
fn it_errors_when_wasm_bindgen_is_not_declared() { fn it_errors_when_wasm_bindgen_is_not_declared() {
let fixture = fixture::bad_cargo_toml(); let fixture = fixture::bad_cargo_toml();
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
assert!(crate_data.check_crate_config().is_err()); assert!(crate_data.check_crate_config().is_err());
} }
@ -294,7 +294,7 @@ fn it_sets_homepage_field_if_available_in_cargo_toml() {
); );
let out_dir = fixture.path.join("pkg"); let out_dir = fixture.path.join("pkg");
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap();
crate_data crate_data
@ -310,7 +310,7 @@ fn it_sets_homepage_field_if_available_in_cargo_toml() {
// When 'homepage' is unavailable // When 'homepage' is unavailable
let fixture = fixture::js_hello_world(); let fixture = fixture::js_hello_world();
let out_dir = fixture.path.join("pkg"); let out_dir = fixture.path.join("pkg");
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap();
crate_data crate_data
@ -326,7 +326,7 @@ fn it_does_not_error_when_wasm_bindgen_is_declared() {
let fixture = fixture::js_hello_world(); let fixture = fixture::js_hello_world();
// Ensure that there is a `Cargo.lock`. // Ensure that there is a `Cargo.lock`.
fixture.cargo_check(); fixture.cargo_check();
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
crate_data.check_crate_config().unwrap(); crate_data.check_crate_config().unwrap();
} }
@ -410,7 +410,7 @@ fn it_lists_license_files_in_files_field_of_package_json() {
let fixture = fixture::dual_license(); let fixture = fixture::dual_license();
let out_dir = fixture.path.join("pkg"); let out_dir = fixture.path.join("pkg");
let crate_data = manifest::CrateData::new(&fixture.path).unwrap(); let crate_data = manifest::CrateData::new(&fixture.path, None).unwrap();
wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap(); wasm_pack::command::utils::create_pkg_dir(&out_dir).unwrap();
license::copy_from_crate(&crate_data, &fixture.path, &out_dir).unwrap(); license::copy_from_crate(&crate_data, &fixture.path, &out_dir).unwrap();

Loading…
Cancel
Save