From 729d543802d5642d9d098cddd53f821a03cf22d5 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 4 Jul 2018 17:15:27 +0800 Subject: [PATCH 01/16] fix(mainfest): missing _bg.js file in package.json --- src/manifest.rs | 3 ++- tests/manifest/main.rs | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/manifest.rs b/src/manifest.rs index 7addfb5..7dc2edd 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -71,6 +71,7 @@ impl CargoManifest { fn into_npm(mut self, scope: &Option, disable_dts: bool) -> NpmPackage { let filename = self.package.name.replace("-", "_"); let wasm_file = format!("{}_bg.wasm", filename); + let js_bg_file = format!("{}_bg.js", filename); let js_file = format!("{}.js", filename); let dts_file = if disable_dts == true { None @@ -81,7 +82,7 @@ impl CargoManifest { if let Some(s) = scope { self.package.name = format!("@{}/{}", s, self.package.name); } - let mut files = vec![wasm_file]; + let mut files = vec![wasm_file, js_bg_file]; match dts_file { Some(ref dts_file) => { diff --git a/tests/manifest/main.rs b/tests/manifest/main.rs index 6f2b039..d117127 100644 --- a/tests/manifest/main.rs +++ b/tests/manifest/main.rs @@ -59,7 +59,10 @@ fn it_creates_a_package_json_default_path() { pkg.repository.url, "https://github.com/ashleygwilliams/wasm-pack.git" ); - assert_eq!(pkg.files, ["wasm_pack_bg.wasm", "wasm_pack.d.ts"]); + assert_eq!( + pkg.files, + ["wasm_pack_bg.wasm", "wasm_pack_bg.js", "wasm_pack.d.ts"] + ); assert_eq!(pkg.main, "wasm_pack.js"); let types = pkg.types.unwrap_or_default(); assert_eq!(types, "wasm_pack.d.ts"); From 5a604520660459b12397def89b3443c5a5774ff5 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Fri, 13 Jul 2018 16:00:05 +0200 Subject: [PATCH 02/16] doc(readme) Fix markup Best contribution ever <3. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1509b4d..659de3d 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ check out our [contribution policy]. 6. Run `wasm-pack init`, optionally, pass a path to a dir or a scope (see above for details) 7. This tool generates files in a `pkg` dir 8. To publish to npm, run `wasm-pack publish`. You may need to login to the - registry you want to publish to. You can login using `wasm-pack login`.` + registry you want to publish to. You can login using `wasm-pack login`. [rust-wasm/36]: https://github.com/rustwasm/team/issues/36 [wasm-bindgen]: https://github.com/alexcrichton/wasm-bindgen From 35fc9e048b240052de91462f32047c0c971aeba9 Mon Sep 17 00:00:00 2001 From: ashley williams Date: Fri, 13 Jul 2018 11:33:38 -0400 Subject: [PATCH 03/16] Revert "fix(mainfest): missing _bg.js file in package.json" --- src/manifest.rs | 3 +-- tests/manifest/main.rs | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/manifest.rs b/src/manifest.rs index 7dc2edd..7addfb5 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -71,7 +71,6 @@ impl CargoManifest { fn into_npm(mut self, scope: &Option, disable_dts: bool) -> NpmPackage { let filename = self.package.name.replace("-", "_"); let wasm_file = format!("{}_bg.wasm", filename); - let js_bg_file = format!("{}_bg.js", filename); let js_file = format!("{}.js", filename); let dts_file = if disable_dts == true { None @@ -82,7 +81,7 @@ impl CargoManifest { if let Some(s) = scope { self.package.name = format!("@{}/{}", s, self.package.name); } - let mut files = vec![wasm_file, js_bg_file]; + let mut files = vec![wasm_file]; match dts_file { Some(ref dts_file) => { diff --git a/tests/manifest/main.rs b/tests/manifest/main.rs index d117127..6f2b039 100644 --- a/tests/manifest/main.rs +++ b/tests/manifest/main.rs @@ -59,10 +59,7 @@ fn it_creates_a_package_json_default_path() { pkg.repository.url, "https://github.com/ashleygwilliams/wasm-pack.git" ); - assert_eq!( - pkg.files, - ["wasm_pack_bg.wasm", "wasm_pack_bg.js", "wasm_pack.d.ts"] - ); + assert_eq!(pkg.files, ["wasm_pack_bg.wasm", "wasm_pack.d.ts"]); assert_eq!(pkg.main, "wasm_pack.js"); let types = pkg.types.unwrap_or_default(); assert_eq!(types, "wasm_pack.d.ts"); From bf222549afcfe3a45cb40d105d246e1971c77e6c Mon Sep 17 00:00:00 2001 From: Ian McIntyre Date: Fri, 6 Jul 2018 18:37:57 -0400 Subject: [PATCH 04/16] Include the wasm-bindgen JS bridge file in files --- src/manifest.rs | 4 +++- tests/manifest/main.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/manifest.rs b/src/manifest.rs index 7addfb5..ef82754 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -72,6 +72,8 @@ impl CargoManifest { let filename = self.package.name.replace("-", "_"); let wasm_file = format!("{}_bg.wasm", filename); let js_file = format!("{}.js", filename); + let bindgen_js_file = format!("{}_bg.js", filename); + let dts_file = if disable_dts == true { None } else { @@ -81,7 +83,7 @@ impl CargoManifest { if let Some(s) = scope { self.package.name = format!("@{}/{}", s, self.package.name); } - let mut files = vec![wasm_file]; + let mut files = vec![wasm_file, bindgen_js_file]; match dts_file { Some(ref dts_file) => { diff --git a/tests/manifest/main.rs b/tests/manifest/main.rs index 6f2b039..77e0524 100644 --- a/tests/manifest/main.rs +++ b/tests/manifest/main.rs @@ -59,7 +59,7 @@ fn it_creates_a_package_json_default_path() { pkg.repository.url, "https://github.com/ashleygwilliams/wasm-pack.git" ); - assert_eq!(pkg.files, ["wasm_pack_bg.wasm", "wasm_pack.d.ts"]); + assert_eq!(pkg.files, ["wasm_pack_bg.wasm", "wasm_pack_bg.js", "wasm_pack.d.ts"]); assert_eq!(pkg.main, "wasm_pack.js"); let types = pkg.types.unwrap_or_default(); assert_eq!(types, "wasm_pack.d.ts"); From e9b05b2181a6e5d5333b9480a088d4278e48d1d4 Mon Sep 17 00:00:00 2001 From: Ian McIntyre Date: Fri, 6 Jul 2018 18:42:12 -0400 Subject: [PATCH 05/16] Use sets to compare package.json files content Order doesn't matter! --- tests/manifest/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/manifest/main.rs b/tests/manifest/main.rs index 77e0524..d3d2198 100644 --- a/tests/manifest/main.rs +++ b/tests/manifest/main.rs @@ -6,6 +6,7 @@ extern crate wasm_pack; mod utils; +use std::collections::HashSet; use std::fs; use wasm_pack::manifest; @@ -59,10 +60,17 @@ fn it_creates_a_package_json_default_path() { pkg.repository.url, "https://github.com/ashleygwilliams/wasm-pack.git" ); - assert_eq!(pkg.files, ["wasm_pack_bg.wasm", "wasm_pack_bg.js", "wasm_pack.d.ts"]); assert_eq!(pkg.main, "wasm_pack.js"); let types = pkg.types.unwrap_or_default(); assert_eq!(types, "wasm_pack.d.ts"); + + let actual_files: HashSet = pkg.files.into_iter().collect(); + let expected_files: HashSet = ["wasm_pack_bg.wasm", "wasm_pack_bg.js", "wasm_pack.d.ts"] + .iter() + .map(|&s| String::from(s)) + .collect(); + assert_eq!(actual_files, expected_files); + } #[test] From b04c3a8f53739704fbe4d14d1fe22de3fafe4a41 Mon Sep 17 00:00:00 2001 From: Ian McIntyre Date: Fri, 6 Jul 2018 19:21:13 -0400 Subject: [PATCH 06/16] Add additional asserts for package.json files --- tests/manifest/main.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/manifest/main.rs b/tests/manifest/main.rs index d3d2198..0879ee3 100644 --- a/tests/manifest/main.rs +++ b/tests/manifest/main.rs @@ -84,6 +84,13 @@ fn it_creates_a_package_json_provided_path() { assert!(utils::read_package_json(&path).is_ok()); let pkg = utils::read_package_json(&path).unwrap(); assert_eq!(pkg.name, "js-hello-world"); + + let actual_files: HashSet = pkg.files.into_iter().collect(); + let expected_files: HashSet = ["js_hello_world_bg.wasm", "js_hello_world_bg.js", "js_hello_world.d.ts"] + .iter() + .map(|&s| String::from(s)) + .collect(); + assert_eq!(actual_files, expected_files); } #[test] @@ -97,6 +104,13 @@ fn it_creates_a_package_json_provided_path_with_scope() { assert!(utils::read_package_json(&path).is_ok()); let pkg = utils::read_package_json(&path).unwrap(); assert_eq!(pkg.name, "@test/scopes-hello-world"); + + let actual_files: HashSet = pkg.files.into_iter().collect(); + let expected_files: HashSet = ["scopes_hello_world_bg.wasm", "scopes_hello_world_bg.js", "scopes_hello_world.d.ts"] + .iter() + .map(|&s| String::from(s)) + .collect(); + assert_eq!(actual_files, expected_files); } #[test] From 6061eb5595176bb7fbe438b47e5a702f599b255e Mon Sep 17 00:00:00 2001 From: Ian McIntyre Date: Fri, 6 Jul 2018 19:30:56 -0400 Subject: [PATCH 07/16] Run rustfmt --- tests/manifest/main.rs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/manifest/main.rs b/tests/manifest/main.rs index 0879ee3..273a21b 100644 --- a/tests/manifest/main.rs +++ b/tests/manifest/main.rs @@ -65,12 +65,12 @@ fn it_creates_a_package_json_default_path() { assert_eq!(types, "wasm_pack.d.ts"); let actual_files: HashSet = pkg.files.into_iter().collect(); - let expected_files: HashSet = ["wasm_pack_bg.wasm", "wasm_pack_bg.js", "wasm_pack.d.ts"] - .iter() - .map(|&s| String::from(s)) - .collect(); + let expected_files: HashSet = + ["wasm_pack_bg.wasm", "wasm_pack_bg.js", "wasm_pack.d.ts"] + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); - } #[test] @@ -86,8 +86,11 @@ fn it_creates_a_package_json_provided_path() { assert_eq!(pkg.name, "js-hello-world"); let actual_files: HashSet = pkg.files.into_iter().collect(); - let expected_files: HashSet = ["js_hello_world_bg.wasm", "js_hello_world_bg.js", "js_hello_world.d.ts"] - .iter() + let expected_files: HashSet = [ + "js_hello_world_bg.wasm", + "js_hello_world_bg.js", + "js_hello_world.d.ts", + ].iter() .map(|&s| String::from(s)) .collect(); assert_eq!(actual_files, expected_files); @@ -106,8 +109,11 @@ fn it_creates_a_package_json_provided_path_with_scope() { assert_eq!(pkg.name, "@test/scopes-hello-world"); let actual_files: HashSet = pkg.files.into_iter().collect(); - let expected_files: HashSet = ["scopes_hello_world_bg.wasm", "scopes_hello_world_bg.js", "scopes_hello_world.d.ts"] - .iter() + let expected_files: HashSet = [ + "scopes_hello_world_bg.wasm", + "scopes_hello_world_bg.js", + "scopes_hello_world.d.ts", + ].iter() .map(|&s| String::from(s)) .collect(); assert_eq!(actual_files, expected_files); From 8eb01dd4a3422dc8d57ab5629224d8d7af438fef Mon Sep 17 00:00:00 2001 From: Ian McIntyre Date: Tue, 10 Jul 2018 19:55:47 -0400 Subject: [PATCH 08/16] Add additional asserts for JS main manifest files --- tests/manifest/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/manifest/main.rs b/tests/manifest/main.rs index 273a21b..53b59d4 100644 --- a/tests/manifest/main.rs +++ b/tests/manifest/main.rs @@ -84,6 +84,8 @@ fn it_creates_a_package_json_provided_path() { assert!(utils::read_package_json(&path).is_ok()); let pkg = utils::read_package_json(&path).unwrap(); assert_eq!(pkg.name, "js-hello-world"); + assert_eq!(pkg.main, "js_hello_world.js"); + let actual_files: HashSet = pkg.files.into_iter().collect(); let expected_files: HashSet = [ @@ -107,6 +109,7 @@ fn it_creates_a_package_json_provided_path_with_scope() { assert!(utils::read_package_json(&path).is_ok()); let pkg = utils::read_package_json(&path).unwrap(); assert_eq!(pkg.name, "@test/scopes-hello-world"); + assert_eq!(pkg.main, "scopes_hello_world.js"); let actual_files: HashSet = pkg.files.into_iter().collect(); let expected_files: HashSet = [ From e4d7048c105face1cd817658fde9a1d0beb95a05 Mon Sep 17 00:00:00 2001 From: Ian McIntyre Date: Tue, 10 Jul 2018 20:03:36 -0400 Subject: [PATCH 09/16] One more rustfmt run! --- tests/manifest/main.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/manifest/main.rs b/tests/manifest/main.rs index 53b59d4..3122583 100644 --- a/tests/manifest/main.rs +++ b/tests/manifest/main.rs @@ -86,7 +86,6 @@ fn it_creates_a_package_json_provided_path() { assert_eq!(pkg.name, "js-hello-world"); assert_eq!(pkg.main, "js_hello_world.js"); - let actual_files: HashSet = pkg.files.into_iter().collect(); let expected_files: HashSet = [ "js_hello_world_bg.wasm", From 5004517bf05bbc60c73c513eebe642a3e28c44bb Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Fri, 13 Jul 2018 14:24:49 -0400 Subject: [PATCH 10/16] fix(files): set files correctly for node and cleanup tests --- src/command/init.rs | 2 +- src/manifest.rs | 21 +++++++++++++++++---- tests/manifest/main.rs | 39 +++++++++++++++++++++++++++++++++------ 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/src/command/init.rs b/src/command/init.rs index b65c7e3..4fd895b 100644 --- a/src/command/init.rs +++ b/src/command/init.rs @@ -161,7 +161,7 @@ impl Init { fn step_create_json(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { info!(&log, "Writing a package.json..."); - manifest::write_package_json(&self.crate_path, &self.scope, self.disable_dts, step)?; + manifest::write_package_json(&self.crate_path, &self.scope, self.disable_dts, &self.target, step)?; #[cfg(not(target_os = "windows"))] info!( &log, diff --git a/src/manifest.rs b/src/manifest.rs index ef82754..b1f72ff 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -68,11 +68,10 @@ fn read_cargo_toml(path: &str) -> Result { } impl CargoManifest { - fn into_npm(mut self, scope: &Option, disable_dts: bool) -> NpmPackage { + fn into_npm(mut self, scope: &Option, disable_dts: bool, target: &str) -> NpmPackage { let filename = self.package.name.replace("-", "_"); let wasm_file = format!("{}_bg.wasm", filename); let js_file = format!("{}.js", filename); - let bindgen_js_file = format!("{}_bg.js", filename); let dts_file = if disable_dts == true { None @@ -80,10 +79,16 @@ impl CargoManifest { Some(format!("{}.d.ts", filename)) }; + let js_bg_file = if target == "nodejs" { + Some(format!("{}_bg.js", filename)) + } else { + None + }; + if let Some(s) = scope { self.package.name = format!("@{}/{}", s, self.package.name); } - let mut files = vec![wasm_file, bindgen_js_file]; + let mut files = vec![wasm_file]; match dts_file { Some(ref dts_file) => { @@ -92,6 +97,13 @@ impl CargoManifest { None => {} } + match js_bg_file { + Some(ref js_bg_file) => { + files.push(js_bg_file.to_string()); + } + None => {} + } + NpmPackage { name: self.package.name, collaborators: self.package.authors, @@ -114,6 +126,7 @@ pub fn write_package_json( path: &str, scope: &Option, disable_dts: bool, + target: &str, step: &Step, ) -> Result<(), Error> { let msg = format!("{}Writing a package.json...", emoji::MEMO); @@ -129,7 +142,7 @@ pub fn write_package_json( let pkg_file_path = format!("{}/pkg/package.json", path); let mut pkg_file = File::create(pkg_file_path)?; let crate_data = read_cargo_toml(path)?; - let npm_data = crate_data.into_npm(scope, disable_dts); + let npm_data = crate_data.into_npm(scope, disable_dts, target); if npm_data.description.is_none() { PBAR.warn(&warn_fmt("description")); diff --git a/tests/manifest/main.rs b/tests/manifest/main.rs index 3122583..e82ee90 100644 --- a/tests/manifest/main.rs +++ b/tests/manifest/main.rs @@ -49,7 +49,7 @@ fn it_creates_a_package_json_default_path() { let step = wasm_pack::progressbar::Step::new(1); let path = ".".to_string(); wasm_pack::command::init::create_pkg_dir(&path, &step).unwrap(); - assert!(manifest::write_package_json(&path, &None, false, &step).is_ok()); + assert!(manifest::write_package_json(&path, &None, false, "", &step).is_ok()); let package_json_path = format!("{}/pkg/package.json", &path); assert!(fs::metadata(package_json_path).is_ok()); assert!(utils::read_package_json(&path).is_ok()); @@ -66,7 +66,7 @@ fn it_creates_a_package_json_default_path() { let actual_files: HashSet = pkg.files.into_iter().collect(); let expected_files: HashSet = - ["wasm_pack_bg.wasm", "wasm_pack_bg.js", "wasm_pack.d.ts"] + ["wasm_pack_bg.wasm", "wasm_pack.d.ts"] .iter() .map(|&s| String::from(s)) .collect(); @@ -78,7 +78,7 @@ fn it_creates_a_package_json_provided_path() { let step = wasm_pack::progressbar::Step::new(1); let path = "tests/fixtures/js-hello-world".to_string(); wasm_pack::command::init::create_pkg_dir(&path, &step).unwrap(); - assert!(manifest::write_package_json(&path, &None, false, &step).is_ok()); + assert!(manifest::write_package_json(&path, &None, false, "", &step).is_ok()); let package_json_path = format!("{}/pkg/package.json", &path); assert!(fs::metadata(package_json_path).is_ok()); assert!(utils::read_package_json(&path).is_ok()); @@ -89,7 +89,6 @@ fn it_creates_a_package_json_provided_path() { let actual_files: HashSet = pkg.files.into_iter().collect(); let expected_files: HashSet = [ "js_hello_world_bg.wasm", - "js_hello_world_bg.js", "js_hello_world.d.ts", ].iter() .map(|&s| String::from(s)) @@ -102,7 +101,7 @@ fn it_creates_a_package_json_provided_path_with_scope() { let step = wasm_pack::progressbar::Step::new(1); let path = "tests/fixtures/scopes".to_string(); wasm_pack::command::init::create_pkg_dir(&path, &step).unwrap(); - assert!(manifest::write_package_json(&path, &Some("test".to_string()), false, &step).is_ok()); + assert!(manifest::write_package_json(&path, &Some("test".to_string()), false, "", &step).is_ok()); let package_json_path = format!("{}/pkg/package.json", &path); assert!(fs::metadata(package_json_path).is_ok()); assert!(utils::read_package_json(&path).is_ok()); @@ -113,7 +112,6 @@ fn it_creates_a_package_json_provided_path_with_scope() { let actual_files: HashSet = pkg.files.into_iter().collect(); let expected_files: HashSet = [ "scopes_hello_world_bg.wasm", - "scopes_hello_world_bg.js", "scopes_hello_world.d.ts", ].iter() .map(|&s| String::from(s)) @@ -121,6 +119,35 @@ fn it_creates_a_package_json_provided_path_with_scope() { assert_eq!(actual_files, expected_files); } +#[test] +fn it_creates_a_pkg_json_with_correct_files_on_node() { + let step = wasm_pack::progressbar::Step::new(1); + let path = ".".to_string(); + wasm_pack::command::init::create_pkg_dir(&path, &step).unwrap(); + assert!(manifest::write_package_json(&path, &None, false, "nodejs", &step).is_ok()); + let package_json_path = format!("{}/pkg/package.json", &path); + assert!(fs::metadata(package_json_path).is_ok()); + assert!(utils::read_package_json(&path).is_ok()); + let pkg = utils::read_package_json(&path).unwrap(); + assert_eq!(pkg.name, "wasm-pack"); + assert_eq!(pkg.repository.ty, "git"); + assert_eq!( + pkg.repository.url, + "https://github.com/ashleygwilliams/wasm-pack.git" + ); + assert_eq!(pkg.main, "wasm_pack.js"); + let types = pkg.types.unwrap_or_default(); + assert_eq!(types, "wasm_pack.d.ts"); + + let actual_files: HashSet = pkg.files.into_iter().collect(); + let expected_files: HashSet = + ["wasm_pack_bg.wasm", "wasm_pack_bg.js", "wasm_pack.d.ts"] + .iter() + .map(|&s| String::from(s)) + .collect(); + assert_eq!(actual_files, expected_files); +} + #[test] fn it_errors_when_wasm_bindgen_is_not_declared() { let step = wasm_pack::progressbar::Step::new(1); From 180c2386adf2b6f18c2d37a413863e09677aedff Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Fri, 13 Jul 2018 14:33:21 -0400 Subject: [PATCH 11/16] test(skip_types): check files key for pkgjsons that skip types --- tests/manifest/main.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/manifest/main.rs b/tests/manifest/main.rs index e82ee90..97f4940 100644 --- a/tests/manifest/main.rs +++ b/tests/manifest/main.rs @@ -148,6 +148,33 @@ fn it_creates_a_pkg_json_with_correct_files_on_node() { assert_eq!(actual_files, expected_files); } +#[test] +fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() { + let step = wasm_pack::progressbar::Step::new(1); + let path = ".".to_string(); + wasm_pack::command::init::create_pkg_dir(&path, &step).unwrap(); + assert!(manifest::write_package_json(&path, &None, true, "", &step).is_ok()); + let package_json_path = format!("{}/pkg/package.json", &path); + assert!(fs::metadata(package_json_path).is_ok()); + assert!(utils::read_package_json(&path).is_ok()); + let pkg = utils::read_package_json(&path).unwrap(); + assert_eq!(pkg.name, "wasm-pack"); + assert_eq!(pkg.repository.ty, "git"); + assert_eq!( + pkg.repository.url, + "https://github.com/ashleygwilliams/wasm-pack.git" + ); + assert_eq!(pkg.main, "wasm_pack.js"); + + let actual_files: HashSet = pkg.files.into_iter().collect(); + let expected_files: HashSet = + ["wasm_pack_bg.wasm"] + .iter() + .map(|&s| String::from(s)) + .collect(); + assert_eq!(actual_files, expected_files); +} + #[test] fn it_errors_when_wasm_bindgen_is_not_declared() { let step = wasm_pack::progressbar::Step::new(1); From 4d5c7b8b3a57970eb7d81fc60f8ea96e394bee4c Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Fri, 13 Jul 2018 15:03:45 -0400 Subject: [PATCH 12/16] fix(style): appease cargo fmt --- src/command/init.rs | 8 +++++++- src/manifest.rs | 12 ++++++------ tests/manifest/main.rs | 36 ++++++++++++++++-------------------- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/command/init.rs b/src/command/init.rs index 4fd895b..d35cf95 100644 --- a/src/command/init.rs +++ b/src/command/init.rs @@ -161,7 +161,13 @@ impl Init { fn step_create_json(&mut self, step: &Step, log: &Logger) -> Result<(), Error> { info!(&log, "Writing a package.json..."); - manifest::write_package_json(&self.crate_path, &self.scope, self.disable_dts, &self.target, step)?; + manifest::write_package_json( + &self.crate_path, + &self.scope, + self.disable_dts, + &self.target, + step, + )?; #[cfg(not(target_os = "windows"))] info!( &log, diff --git a/src/manifest.rs b/src/manifest.rs index b1f72ff..e545a1a 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -80,9 +80,9 @@ impl CargoManifest { }; let js_bg_file = if target == "nodejs" { - Some(format!("{}_bg.js", filename)) + Some(format!("{}_bg.js", filename)) } else { - None + None }; if let Some(s) = scope { @@ -98,10 +98,10 @@ impl CargoManifest { } match js_bg_file { - Some(ref js_bg_file) => { - files.push(js_bg_file.to_string()); - } - None => {} + Some(ref js_bg_file) => { + files.push(js_bg_file.to_string()); + } + None => {} } NpmPackage { diff --git a/tests/manifest/main.rs b/tests/manifest/main.rs index 97f4940..cf66196 100644 --- a/tests/manifest/main.rs +++ b/tests/manifest/main.rs @@ -65,11 +65,10 @@ fn it_creates_a_package_json_default_path() { assert_eq!(types, "wasm_pack.d.ts"); let actual_files: HashSet = pkg.files.into_iter().collect(); - let expected_files: HashSet = - ["wasm_pack_bg.wasm", "wasm_pack.d.ts"] - .iter() - .map(|&s| String::from(s)) - .collect(); + let expected_files: HashSet = ["wasm_pack_bg.wasm", "wasm_pack.d.ts"] + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } @@ -78,7 +77,7 @@ fn it_creates_a_package_json_provided_path() { let step = wasm_pack::progressbar::Step::new(1); let path = "tests/fixtures/js-hello-world".to_string(); wasm_pack::command::init::create_pkg_dir(&path, &step).unwrap(); - assert!(manifest::write_package_json(&path, &None, false, "", &step).is_ok()); + assert!(manifest::write_package_json(&path, &None, false, "", &step).is_ok()); let package_json_path = format!("{}/pkg/package.json", &path); assert!(fs::metadata(package_json_path).is_ok()); assert!(utils::read_package_json(&path).is_ok()); @@ -87,10 +86,8 @@ fn it_creates_a_package_json_provided_path() { assert_eq!(pkg.main, "js_hello_world.js"); let actual_files: HashSet = pkg.files.into_iter().collect(); - let expected_files: HashSet = [ - "js_hello_world_bg.wasm", - "js_hello_world.d.ts", - ].iter() + let expected_files: HashSet = ["js_hello_world_bg.wasm", "js_hello_world.d.ts"] + .iter() .map(|&s| String::from(s)) .collect(); assert_eq!(actual_files, expected_files); @@ -101,7 +98,9 @@ fn it_creates_a_package_json_provided_path_with_scope() { let step = wasm_pack::progressbar::Step::new(1); let path = "tests/fixtures/scopes".to_string(); wasm_pack::command::init::create_pkg_dir(&path, &step).unwrap(); - assert!(manifest::write_package_json(&path, &Some("test".to_string()), false, "", &step).is_ok()); + assert!( + manifest::write_package_json(&path, &Some("test".to_string()), false, "", &step).is_ok() + ); let package_json_path = format!("{}/pkg/package.json", &path); assert!(fs::metadata(package_json_path).is_ok()); assert!(utils::read_package_json(&path).is_ok()); @@ -110,10 +109,8 @@ fn it_creates_a_package_json_provided_path_with_scope() { assert_eq!(pkg.main, "scopes_hello_world.js"); let actual_files: HashSet = pkg.files.into_iter().collect(); - let expected_files: HashSet = [ - "scopes_hello_world_bg.wasm", - "scopes_hello_world.d.ts", - ].iter() + let expected_files: HashSet = ["scopes_hello_world_bg.wasm", "scopes_hello_world.d.ts"] + .iter() .map(|&s| String::from(s)) .collect(); assert_eq!(actual_files, expected_files); @@ -167,11 +164,10 @@ fn it_creates_a_package_json_with_correct_keys_when_types_are_skipped() { assert_eq!(pkg.main, "wasm_pack.js"); let actual_files: HashSet = pkg.files.into_iter().collect(); - let expected_files: HashSet = - ["wasm_pack_bg.wasm"] - .iter() - .map(|&s| String::from(s)) - .collect(); + let expected_files: HashSet = ["wasm_pack_bg.wasm"] + .iter() + .map(|&s| String::from(s)) + .collect(); assert_eq!(actual_files, expected_files); } From 805b796cf9e546be3f4d577933d7327fa37a4903 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Fri, 13 Jul 2018 15:08:32 -0700 Subject: [PATCH 13/16] Deny missing documentation And add all the missing doc comments. --- src/bindgen.rs | 5 +++++ src/build.rs | 7 +++++++ src/command/init.rs | 13 +++++++++++++ src/command/mod.rs | 16 ++++++++++++++-- src/command/utils.rs | 4 ++++ src/emoji.rs | 13 +++++++++++++ src/error.rs | 24 ++++++++++++++++++++++-- src/lib.rs | 7 +++++++ src/logger.rs | 2 ++ src/manifest.rs | 4 ++++ src/npm.rs | 6 ++++++ src/progressbar.rs | 18 ++++++++++++++++++ src/readme.rs | 3 +++ 13 files changed, 118 insertions(+), 4 deletions(-) diff --git a/src/bindgen.rs b/src/bindgen.rs index dece43f..61d9ac1 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -1,9 +1,12 @@ +//! Functionality related to installing and running `wasm-bindgen`. + use emoji; use error::Error; use progressbar::Step; use std::process::Command; use PBAR; +/// Install the `wasm-bindgen` CLI with `cargo install`. pub fn cargo_install_wasm_bindgen(step: &Step) -> Result<(), Error> { let msg = format!("{}Installing WASM-bindgen...", emoji::DOWN_ARROW); PBAR.step(step, &msg); @@ -24,6 +27,8 @@ pub fn cargo_install_wasm_bindgen(step: &Step) -> Result<(), Error> { } } +/// Run the `wasm-bindgen` CLI to generate bindings for the current crate's +/// `.wasm`. pub fn wasm_bindgen_build( path: &str, name: &str, diff --git a/src/build.rs b/src/build.rs index 61d02d2..1744f99 100644 --- a/src/build.rs +++ b/src/build.rs @@ -1,9 +1,13 @@ +//! Building a Rust crate into a `.wasm` binary. + use emoji; use error::Error; use progressbar::Step; use std::process::Command; use PBAR; +/// Ensure that `rustup` has the `wasm32-unknown-unknown` target installed for +/// the `nightly` toolchain. pub fn rustup_add_wasm_target(step: &Step) -> Result<(), Error> { let msg = format!("{}Adding WASM target...", emoji::TARGET); PBAR.step(step, &msg); @@ -23,6 +27,7 @@ pub fn rustup_add_wasm_target(step: &Step) -> Result<(), Error> { } } +/// Ensure that the `nightly` toolchain is installed in `rustup`. fn ensure_nightly() -> Result<(), Error> { let nightly_check = Command::new("rustc").arg("+nightly").arg("-V").output()?; if !nightly_check.status.success() { @@ -39,6 +44,8 @@ fn ensure_nightly() -> Result<(), Error> { Ok(()) } +/// Run `cargo build` with the `nightly` toolchain and targetting +/// `wasm32-unknown-unknown`. pub fn cargo_build_wasm(path: &str, debug: bool, step: &Step) -> Result<(), Error> { let msg = format!("{}Compiling to WASM...", emoji::CYCLONE); PBAR.step(step, &msg); diff --git a/src/command/init.rs b/src/command/init.rs index d35cf95..bec96f8 100644 --- a/src/command/init.rs +++ b/src/command/init.rs @@ -1,3 +1,5 @@ +//! Initializing a crate for packing `.wasm`s. + use bindgen; use build; use command::utils::set_crate_path; @@ -12,6 +14,7 @@ use std::fs; use std::time::Instant; use PBAR; +/// Construct our `pkg` directory in the crate. pub fn create_pkg_dir(path: &str, step: &Step) -> Result<(), Error> { let msg = format!("{}Creating a pkg directory...", emoji::FOLDER); PBAR.step(step, &msg); @@ -20,12 +23,20 @@ pub fn create_pkg_dir(path: &str, step: &Step) -> Result<(), Error> { Ok(()) } +/// The `InitMode` determines which mode of initialization we are running, and +/// what build and install steps we perform. pub enum InitMode { + /// Perform all the build and install steps. Normal, + /// Don't build the crate as a `.wasm` but do install tools and create + /// meta-data. Nobuild, + /// Don't install tools like `wasm-bindgen`, just use the global + /// environment's existing versions to do builds. Noinstall, } +/// Everything required to configure and run the `wasm-pack init` command. pub struct Init { crate_path: String, scope: Option, @@ -38,6 +49,7 @@ pub struct Init { type InitStep = fn(&mut Init, &Step, &Logger) -> Result<(), Error>; impl Init { + /// Construct a new `Init` command. pub fn new( path: Option, scope: Option, @@ -92,6 +104,7 @@ impl Init { } } + /// Execute this `Init` command. pub fn process(&mut self, log: &Logger, mode: InitMode) -> Result<(), Error> { let process_steps = Init::get_process_steps(mode); diff --git a/src/command/mod.rs b/src/command/mod.rs index d3c9b7e..2f477b9 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -1,3 +1,5 @@ +//! CLI command structures, parsing, and execution. + pub mod init; mod login; mod pack; @@ -13,13 +15,16 @@ use slog::Logger; use std::result; use PBAR; +/// The various kinds of commands that `wasm-pack` can execute. #[derive(Debug, StructOpt)] pub enum Command { #[structopt(name = "init")] /// 🐣 initialize a package.json based on your compiled wasm! Init { + /// The path to the Rust crate. path: Option, + /// The npm scope to use in package.json, if any. #[structopt(long = "scope", short = "s")] scope: Option, @@ -43,11 +48,17 @@ pub enum Command { #[structopt(name = "pack")] /// 🍱 create a tar of your npm package but don't publish! - Pack { path: Option }, + Pack { + /// The path to the Rust crate. + path: Option, + }, #[structopt(name = "publish")] /// 🎆 pack up your npm package and publish! - Publish { path: Option }, + Publish { + /// The path to the Rust crate. + path: Option, + }, #[structopt(name = "login", alias = "adduser", alias = "add-user")] /// 👤 Add a registry user account! (aliases: adduser, add-user) @@ -82,6 +93,7 @@ pub enum Command { }, } +/// Run a command with the given logger! pub fn run_wasm_pack(command: Command, log: &Logger) -> result::Result<(), Error> { // Run the correct command based off input and store the result of it so that we can clear // the progress bar then return it diff --git a/src/command/utils.rs b/src/command/utils.rs index ff85ef0..9269534 100644 --- a/src/command/utils.rs +++ b/src/command/utils.rs @@ -1,3 +1,7 @@ +//! Utility functions for commands. + +/// If an explicit path is given, then use it, otherwise assume the current +/// directory is the crate path. pub fn set_crate_path(path: Option) -> String { let crate_path = match path { Some(p) => p, diff --git a/src/emoji.rs b/src/emoji.rs index e93119c..8a7bc8d 100644 --- a/src/emoji.rs +++ b/src/emoji.rs @@ -1,3 +1,16 @@ +//! Emoji contants used by `wasm-pack`. +//! +//! For the woefully unfamiliar: +//! +//! > Emoji are ideograms and smileys used in electronic messages and web +//! > pages. Emoji exist in various genres, including facial expressions, common +//! > objects, places and types of weather, and animals. They are much like +//! > emoticons, but emoji are actual pictures instead of typographics. +//! +//! -- https://en.wikipedia.org/wiki/Emoji + +#![allow(missing_docs)] + use console::Emoji; pub static TARGET: Emoji = Emoji("🎯 ", ""); diff --git a/src/error.rs b/src/error.rs index 0bd2ba6..1d6f0a7 100644 --- a/src/error.rs +++ b/src/error.rs @@ -4,22 +4,40 @@ use std::borrow::Cow; use std::io; use toml; +/// Errors that can potentially occur in `wasm-pack`. #[derive(Debug, Fail)] pub enum Error { /// Maps any underlying I/O errors that are thrown to this variant #[fail(display = "{}", _0)] Io(#[cause] io::Error), + + /// A JSON serialization or deserialization error. #[fail(display = "{}", _0)] SerdeJson(#[cause] serde_json::Error), + + /// A TOML serialization or deserialization error. #[fail(display = "{}", _0)] SerdeToml(#[cause] toml::de::Error), + + /// An error invoking another CLI tool. #[fail(display = "{}. stderr:\n\n{}", message, stderr)] - Cli { message: String, stderr: String }, + Cli { + /// Error message. + message: String, + /// The underlying CLI's `stderr` output. + stderr: String, + }, + + /// A crate configuration error. #[fail(display = "{}", message)] - CrateConfig { message: String }, + CrateConfig { + /// A message describing the configuration error. + message: String, + }, } impl Error { + /// Construct a CLI error. pub fn cli(message: &str, stderr: Cow) -> Result<(), Self> { Err(Error::Cli { message: message.to_string(), @@ -27,12 +45,14 @@ impl Error { }) } + /// Construct a crate configuration error. pub fn crate_config(message: &str) -> Result<(), Self> { Err(Error::CrateConfig { message: message.to_string(), }) } + /// Get a string description of this error's type. pub fn error_type(&self) -> String { match self { Error::Io(_) => "There was an I/O error. Details:\n\n", diff --git a/src/lib.rs b/src/lib.rs index 7b510b0..1c31bd8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,7 @@ +//! Your favorite rust -> wasm workflow tool! + +#![deny(missing_docs)] + extern crate console; #[macro_use] extern crate failure; @@ -30,14 +34,17 @@ pub mod readme; use progressbar::ProgressOutput; lazy_static! { + /// The global progress bar and user-facing message output. pub static ref PBAR: ProgressOutput = { ProgressOutput::new() }; } /// 📦 ✨ pack and publish your wasm! #[derive(Debug, StructOpt)] pub struct Cli { + /// The subcommand to run. #[structopt(subcommand)] // Note that we mark a field as a subcommand pub cmd: command::Command, + /// Log verbosity is based off the number of v used #[structopt(long = "verbose", short = "v", parse(from_occurrences))] pub verbosity: u8, diff --git a/src/logger.rs b/src/logger.rs index fc7e7f4..3ddea3a 100644 --- a/src/logger.rs +++ b/src/logger.rs @@ -1,3 +1,5 @@ +//! Logging facilities for `wasm-pack`. + use command::Command; use error::Error; use slog::{Drain, Level, Logger}; diff --git a/src/manifest.rs b/src/manifest.rs index e545a1a..a6628c6 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -1,3 +1,5 @@ +//! Reading and writing Cargo.toml and package.json manifests. + use std::fs::File; use std::io::prelude::*; @@ -159,10 +161,12 @@ pub fn write_package_json( Ok(()) } +/// Get the crate name for the crate at the given path. pub fn get_crate_name(path: &str) -> Result { Ok(read_cargo_toml(path)?.package.name) } +/// Check that the crate the given path is properly configured. pub fn check_crate_config(path: &str, step: &Step) -> Result<(), Error> { let msg = format!("{}Checking crate configuration...", emoji::WRENCH); PBAR.step(&step, &msg); diff --git a/src/npm.rs b/src/npm.rs index 3ea414d..befcdd6 100644 --- a/src/npm.rs +++ b/src/npm.rs @@ -1,8 +1,12 @@ +//! Functionality related to publishing to npm. + use error::Error; use std::process::{Command, Stdio}; +/// The default npm registry used when we aren't working with a custom registry. pub const DEFAULT_NPM_REGISTRY: &'static str = "https://registry.npmjs.org/"; +/// Run the `npm pack` command. pub fn npm_pack(path: &str) -> Result<(), Error> { let pkg_file_path = format!("{}/pkg", path); let output = Command::new("npm") @@ -17,6 +21,7 @@ pub fn npm_pack(path: &str) -> Result<(), Error> { } } +/// Run the `npm publish` command. pub fn npm_publish(path: &str) -> Result<(), Error> { let pkg_file_path = format!("{}/pkg", path); let output = Command::new("npm") @@ -31,6 +36,7 @@ pub fn npm_publish(path: &str) -> Result<(), Error> { } } +/// Run the `npm login` command. pub fn npm_login( registry: &String, scope: &Option, diff --git a/src/progressbar.rs b/src/progressbar.rs index f2b070c..24a8947 100644 --- a/src/progressbar.rs +++ b/src/progressbar.rs @@ -1,15 +1,19 @@ +//! Fancy progress bar functionality. + use console::style; use emoji; use indicatif::{ProgressBar, ProgressStyle}; use parking_lot::RwLock; use std::fmt; +/// Synchronized progress bar and status message printing. pub struct ProgressOutput { spinner: RwLock, messages: RwLock, } impl ProgressOutput { + /// Construct a new `ProgressOutput`. pub fn new() -> Self { Self { spinner: RwLock::new(ProgressBar::new_spinner()), @@ -17,6 +21,8 @@ impl ProgressOutput { } } + /// Inform the user that the given `step` is being executed, with details in + /// `message`. pub fn step(&self, step: &Step, message: &str) { let msg = format!("{} {}", style(step).bold().dim(), message); self.message(&msg) @@ -31,6 +37,7 @@ impl ProgressOutput { message.clear(); } + /// Print the given message. pub fn message(&self, message: &str) { self.finish(); @@ -45,6 +52,7 @@ impl ProgressOutput { message.push('\n'); } + /// Add an informational message. pub fn info(&self, message: &str) { let info = format!( "{} {}: {}", @@ -55,6 +63,7 @@ impl ProgressOutput { self.add_message(&info); } + /// Add a warning message. pub fn warn(&self, message: &str) { let warn = format!( "{} {}: {}", @@ -65,6 +74,7 @@ impl ProgressOutput { self.add_message(&warn); } + /// Add an error message. pub fn error(&self, message: String) { let err = format!( "{} {}: {}", @@ -87,20 +97,28 @@ impl ProgressOutput { pb } + /// After having built up a series of messages, print all of them out. pub fn done(&self) { self.finish(); } } +/// For processes that can be broken down into N fractional steps, with messages +/// added for each step along the way like +/// +/// > [2/5] Doing the second step out of five. pub struct Step { current: usize, total: usize, } impl Step { + /// Construct a `Step` where there are `total` number of steps. pub fn new(total: usize) -> Step { Step { current: 1, total } } + + /// Increment the current step. pub fn inc(&mut self) { self.current += 1; } diff --git a/src/readme.rs b/src/readme.rs index 041908a..5f631e0 100644 --- a/src/readme.rs +++ b/src/readme.rs @@ -1,3 +1,5 @@ +//! Generating `README` files for the packaged wasm. + use error::Error; use std::fs; @@ -5,6 +7,7 @@ use emoji; use progressbar::Step; use PBAR; +/// Copy the crate's README into the `pkg` directory. pub fn copy_from_crate(path: &str, step: &Step) -> Result<(), Error> { let msg = format!("{}Copying over your README...", emoji::DANCERS); PBAR.step(step, &msg); From 24c0ca7d424dc8e3f690536236b6be7e6bc9a16a Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Fri, 13 Jul 2018 16:23:43 -0700 Subject: [PATCH 14/16] CI: Temporarily run tests with only one thread Until we have proper synchronization for test fixtures. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8fea980..6f93d54 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,9 @@ matrix: # tests pass - rust: nightly script: - - cargo test --locked + # XXX: `--test-threads 1` is a hack until we have a proper fix for + # synchronizing access to the fixtures. + - cargo test --locked -- --test-threads 1 - rustup component add rustfmt-preview - cargo fmt --all -- --check env: RUST_BACKTRACE=1 From 18d707ccd0e43da303761df4926c1a86724f8690 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Fri, 13 Jul 2018 19:24:44 -0400 Subject: [PATCH 15/16] fix(readme): update ci badges to new org --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 659de3d..582c703 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # 📦✨ wasm-pack > Your favorite rust -> wasm workflow tool! -[![Build Status](https://travis-ci.org/ashleygwilliams/wasm-pack.svg?branch=master)](https://travis-ci.org/ashleygwilliams/wasm-pack) -[![Build status](https://ci.appveyor.com/api/projects/status/7jjuo5wewu9lyyfi?svg=true)](https://ci.appveyor.com/project/ashleygwilliams/wasm-pack) +[![Build Status](https://travis-ci.org/rustwasm/wasm-pack.svg?branch=master)](https://travis-ci.org/rustwasm/wasm-pack) +[![Build status](https://ci.appveyor.com/api/projects/status/7jjuo5wewu9lyyfi?svg=true)](https://ci.appveyor.com/project/rustwasm/wasm-pack) This tool seeks to be a one-stop shop for building and working with rust- generated WebAssembly that you would like to interop with JavaScript, in the From b046dd6a3416061ee2e6e42ab740bff52fb4dee7 Mon Sep 17 00:00:00 2001 From: Ashley Williams Date: Fri, 13 Jul 2018 17:51:02 -0400 Subject: [PATCH 16/16] v0.4.1 --- CHANGELOG.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a33cc2..dba3544 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,60 @@ # Changelog +## ⭐ 0.4.1 + +- #### 🤕 Fixes + + - **fix `files` key value for projects build for `nodejs` target - [ashleygwilliams], [issue/199] [pull/205]** + + We became aware that the `files` key in `package.json` did not include the additional `_bg.js` file that + `wasm-bindgen` generates for projects being built for the `nodejs` target. This resulted in the file not + being included in the published package and resulted in a `Module Not Found` error for folks. + + This was a group effort from [mciantyre] with [pull/200] and [Brooooooklyn] with [pull/197]. Thank you so + much for your diligence and patience while we sorted through it. + + [mciantyre]: https://github.com/mciantyre + [Brooooooklyn]: https://github.com/Brooooooklyn + [issue/199]: https://github.com/rustwasm/wasm-pack/issues/199 + [pull/205]: https://github.com/rustwasm/wasm-pack/pull/205 + [pull/197]: https://github.com/rustwasm/wasm-pack/pull/197 + [pull/200]: https://github.com/rustwasm/wasm-pack/pull/200 + +- #### 🛠️ Maintenance + + - **clean up `quicli` remnants - [SoryRawyer], [pull/193]** + + In [v0.3.0] we removed the `quicli` dependency, however there were a few remnants + left behind. They are now removed! + + [SoryRawyer]: https://github.com/SoryRawyer + [pull/193]: https://github.com/rustwasm/wasm-pack/pull/193 + [v0.3.0]: https://github.com/rustwasm/wasm-pack/blob/master/CHANGELOG.md#-030 + +- #### 📖 Documentation + + - **DOCUMENT EVERYTHING!! and deny missing docs for all future development - [fitzgen], [pull/208]** + + The `wasm-pack` team has worked hard on tutorial documentation and keeping the codebase as self-explanatory + as possible, but we have been slowly accruing a documentation debt. This amazing PR, landed just moments + before this point release and was just too good not to include. Thank you so much, [fitzgen]! + + [fitzgen]: https://github.com/fitzgen + [pull/208]: https://github.com/rustwasm/wasm-pack/pull/208 + + - **fix README code example - [steveklabnik], [pull/195]** + + The code example in our `README.md` was missing a critical `pub`. It's there now! + + [pull/195]: https://github.com/rustwasm/wasm-pack/pull/195/files + + - **fix README markup - [Hywan], [pull/202]** + + There was an errant `` ` `` - it's gone now! + + [Hywan]: https://github.com/Hywan + [pull/202]: https://github.com/rustwasm/wasm-pack/pull/202 + ## 🌟 0.4.0 This release has a ton of awesome things in it, but the best thing is that diff --git a/Cargo.lock b/Cargo.lock index 3b99209..1ba4671 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -669,7 +669,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wasm-pack" -version = "0.4.0" +version = "0.4.1" dependencies = [ "console 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 591a290..eba40ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wasm-pack" description = "pack up the wasm and publish it to npm!" -version = "0.4.0" +version = "0.4.1" authors = ["Ashley Williams "] repository = "https://github.com/ashleygwilliams/wasm-pack.git" license = "MIT/Apache-2.0"