diff --git a/CHANGELOG.md b/CHANGELOG.md index 67334fb..6b73f5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,273 @@ # Changelog +## ☀️ 0.5.0 + +- ### ✨ Features + + - #### **Website!** - [ashleygwilliams], [pull/246] + + We have a website now. It has the installer and links to documentation. In the future, + we hope to have calls to action for folks first coming to the site who are looking to + do specific things- these will help them find the docs and tutorials they need to. + + This PR also has a complete rework of our documentation. + + Check it out [here](https://rustwasm.github.io/wasm-pack/)! + + - #### 🍱 Module Support + + - **BREAKING: use correct `package.json` keys for generated JavaScript - [ashleygwilliams], [issue/309] [pull/312]** + + This is marked as potentially breaking because it changes the `package.json` keys that + are generated by the project. + + Previously, we generated a JavaScript file and placed it in the `main` key, regardless + of what you were targeting, ES6 and Node.js alike. + + We have received a lot of requests for `wasm-pack` to generate "isomorphic" packages, + that contain assets that could work on both Node.js and ES6, and this led to us + looking more closely at how we are using `package.json`. + + With this release, we will do the following: + + - `--target broswer`: By default, we generate JS that is an ES6 module. We used to put + this in the `main` field. Now we put it in the `module` field. We also add + `sideEffects: false` so that bundlers that want to tree shake can. + + - `-- target nodejs`: This target doesn't change. We put generated JS that is a + CommonJS module in the `main` key. + + - `-- target no-modules`: This is a new target. For this target we generate bare JavaScript. + This code is put in a `browser` field. + + You can see the structs that represent each target's expected `package.json` [here](https://github.com/rustwasm/wasm-pack/tree/master/src/manifest/npm). + + Thanks so much to [bterlson] for his help in sorting this out for us! + + [bterlson]: https://github.com/bterlson + [issue/309]: https://github.com/rustwasm/wasm-pack/issues/309 + [pull/312]: https://github.com/rustwasm/wasm-pack/pull/312 + + - #### 🛠️ New Commands + + - **`wasm-pack init` is now `wasm-pack build` - [csmoe], [issue/188] [pull/216]** + + When this project was first conceived, we imagined it would be simply a way to package + up generate wasm and js and publish it to npm. Here we are at version `0.5.0` and we + have become much more- an integrated build tool! + + As a result, the original command `init` does a lot more than that these days. We've + renamed the command to better reflect the work it's actually doing. `init` will still + work, but is deprecated now, and we will eventually remove it. + + [csmoe]: https://github.com/csmoe + [issue/188]: https://github.com/rustwasm/wasm-pack/issues/188 + [pull/216]: https://github.com/rustwasm/wasm-pack/pull/216 + + - **add new command: `wasm-pack test` - [fitzgen], [pull/271]** + + This is an experimental new command that will run your tests in Node.js or a headless + browser using `wasm-pack test`. Check out this [tutorial](https://rustwasm.github.io/wasm-bindgen/wasm-bindgen-test/index.html) + to learn more! + + [pull/271]: https://github.com/rustwasm/wasm-pack/pull/271 + + - **add 2FA support to `wasm-pack publish` - [mstallmo], [issue/257] [pull/282]** + + We've been wrapping the `npm login` and `npm publish` commands as `wasm-pack login` + and `wasm-pack publish` for a while now- but we didn't fully support two factor + authentication. Now we do! (Be safe out there! 2FA is good for everyone!) + + [issue/257]: https://github.com/rustwasm/wasm-pack/issues/257 + [pull/282]: https://github.com/rustwasm/wasm-pack/pull/282 + + - #### 🎏 New Flags + + - **New target, bare JavaScript: `--target no-modules` - [ashleygwilliams], [issue/317] [pull/327]** + + `wasm-bindgen` offers a `no-modules` flag that until now, we didn't support. This flag + produces bare, no modules JavaScript. So if that's your thing, this target is for you! + + [issue/317]: https://github.com/rustwasm/wasm-pack/issues/317 + [pull/327]: https://github.com/rustwasm/wasm-pack/pull/327 + + - **`--access` flag for `wasm-pack` publish - [ashleygwilliams], [issue/297] [pull/299]** + + Many of our tutorials use scopes to help prevent folks from attempting to publish + packages that will lead to npm Registry errors because the package name already exists. + + However, by default, scoped packages are assumed by the npm registry to be private, and + the ability to publish private packages to the npm registry is a paid feature. Worry not! + Now you can pass `--access public` to `wasm-pack publish` and publish scoped packages + publicly. + + [issue/297]: https://github.com/rustwasm/wasm-pack/issues/297 + [pull/299]: https://github.com/rustwasm/wasm-pack/pull/299 + + - #### ✅ New Checks + + - **rustc version check - [ashleygwilliams], [issue/351] [pull/353]** + + Now that we have a new fangled installer, there's a chance that folks might install `wasm-pack` + and not have Rust installed. Additionally, now that the features we required from the `nightly` + channel of Rust have moved to `beta`- we don't need to enforce `nightly`. + + As of this release, we will check that your Rust version is above `1.30.0`. You can be on + either the `nightly` or `beta` channel and all of `wasm-pack`s calls to `cargo` will + respect that. + + Really hate this? You can pass `--mode force` to `wasm-pack` to skip this check. I hope you know + what you're doing! + + - **coordinating wasm-bindgen versions and installing from binaries for improved speed - [datapup], [issue/146] [pull/244] [pull/324]** + + This is the true gem of this release. Have you been frustrated by how long `wasm-pack` takes to + run? Overusing `--mode no-install`? This is the release you're looking for. + + Many releases back we realized that folks were struggling to keep the `wasm-bindgen` library + that their project used in sync with the `wasm-bindgen` CLI application which `wasm-pack` + runs for you. This became such an issue that we opted to force install `wasm-bindgen` to ensure + that every `wasm-pack` user had the latest version. + + Like many technical solutions, this solved our original problem, but caused a new one. Now, we + we are forcing a `cargo install` of `wasm-bindgen` on every run, and that means downloading + and compiling `wasm-bindgen` everytime you want to run `wasm-pack`. That's unacceptable! + + We're happy to announce that we have a pretty great solution, and several more planned for + future releases. As of this release, we will read your `Cargo.lock` to find the version of + `wasm-bindgen` you are using in your local project. We will attempt to fetch a binary version + of `wasm-bindgen` that matches your local version. We place that binary local to your project, + and use it when you run `wasm-pack build`. The next time you run `wasm-pack build` we'll use + that binary, instead of fetching a new one. We still fall back to `cargo install` for + less common architectures but this is a huge speed improvement. Check out these benchmarks! + + ##### `wasm-pack` v0.4.2 + + ``` + $ time wasm-pack init # fresh build + real 1m58.802s + user 14m49.679s + sys 0m24.957s + + $ time wasm-pack init # re-build + real 0m56.953s + user 11m12.075s + sys 0m18.835s + + $ time wasm-pack init -m no-install # re-build with no-install + real 0m0.091s + user 0m0.052s + sys 0m0.042s + ``` + + ##### `wasm-pack` v0.5.0 + + ``` + $ time wasm-pack build # fresh build + real 1m3.350s + user 3m46.912s + sys 0m6.057s + + $ time wasm-pack build # re-build + real 0m0.230s + user 0m0.185s + sys 0m0.047s + + $ time wasm-pack build -m no-install # re-build with no-install + real 0m0.104s + user 0m0.066s + sys 0m0.041s + ``` + + [datapup]: https://github.com/datapup + [issue/146]: https://github.com/rustwasm/wasm-pack/issues/146 + [pull/244]: https://github.com/rustwasm/wasm-pack/pull/244 + [pull/324]: https://github.com/rustwasm/wasm-pack/pull/324 + + - **enforce `cargo build` with `--lib` - [ashleygwilliams], [issue/303] [pull/330]** + + Right now, `wasm-pack` only works on Rust library projects. But sometimes, if you're + new to Rust, you might end up having a `main.rs` in your project, just by mistake. + Some folks ran into this and realized that it can cause issues! + + As a result, we are enforcing that `cargo build` only build the library at this time. + + Want to use `wasm-pack` on a binary application? We're interested in hearing from you! + Checkout [issue/326] and please comment! We want to support binary applicaitons in + the future and are always happy and curious to hear about how folks use `wasm-pack`! + + [issue/326]: https://github.com/rustwasm/wasm-pack/issues/326 + [issue/303]: https://github.com/rustwasm/wasm-pack/issues/303 + [pull/330]: https://github.com/rustwasm/wasm-pack/pull/330 + + - #### Installers and Releases + + - **Appveyor Windows Pre-Built binaries - [alexcrichton], [issue/147] [pull/301]** + + We finally got Appveyor to publish pre-built binaries to GitHub releases. + Aside: I really wish there were an easier way to test and debug this stuff. + + [alexcrichton]: https://github.com/alexcrichton + [issue/147]: https://github.com/rustwasm/wasm-pack/issues/147 + [pull/301]: https://github.com/rustwasm/wasm-pack/pull/301 + + - **new experimental installer - [alexcrichton], [pull/307]** + + Whew, this one is exciting. Up until now, `wasm-pack` has been distributed using + `cargo install`. This is not ideal for several reasons. Updating is confusing, + and every time it's installed the user has to wait for it to compile- right at the + moment they just want to hurry up and use it already. + + Say hello to the new `wasm-pack` installer- we have an executable for Windows + and a `curl` script for *nix users. Not pleased with that? File an issue for your + preferred distribution method and we'll do our best to get it working! + + This is experimental- so please try it out and file issues as you run into things! + You'll always be able to use `cargo install` as a backup. + + Checkout the new installer [here](https://rustwasm.github.io/wasm-pack/installer/)! + + [pull/307]: https://github.com/rustwasm/wasm-pack/pull/307 + +- ### 🛠️ Maintenance + + - **testing fixture strategy improvements - [fitzgen], [pull/211] [pull/323]** + + [pull/211]: https://github.com/rustwasm/wasm-pack/pull/211 + [pull/323]: https://github.com/rustwasm/wasm-pack/pull/323 + + - **split testing utils into separate files - [csmoe], [issue/231] [pull/216]** + + [issue/231]: https://github.com/rustwasm/wasm-pack/issues/231 + [pull/216]: https://github.com/rustwasm/wasm-pack/pull/216 + + - **update dependencies - [ashleygwilliams], [issue/319] [pull/320]** + + [issue/319]: https://github.com/rustwasm/wasm-pack/issues/319 + [pull/320]: https://github.com/rustwasm/wasm-pack/pull/320 + +- ### 📖 Documentation + + - **improve readability of warnings about missing optional fields - [twilco], [pull/296]** + + A little punctuation goes a long way. Error message improvement PRs are the best. + + [twilco]: https://github.com/twilco + [pull/296]: https://github.com/rustwasm/wasm-pack/pull/296 + + - **update links in README - [alexcrichton], [pull/300]** + + We had a real dicey documentation situation for a while. Sorry about that, and thank + you SO MUCH to all the folks who filed PRs to fix it. + + [pull/300]: https://github.com/rustwasm/wasm-pack/pull/300 + + - **fix broken links in book by using relative paths - [mstallmo], [issue/325] [pull/328]** + + [mstallmo]: https://github.com/mstallmo + [issue/325]: https://github.com/rustwasm/wasm-pack/issues/325 + [pull/328]: https://github.com/rustwasm/wasm-pack/pull/328 + ## ✨ 0.4.2 - #### 🤕 Fixes diff --git a/Cargo.lock b/Cargo.lock index 5a0c84b..9cf4cf6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -959,7 +959,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wasm-pack" -version = "0.4.2" +version = "0.5.0" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "cargo_metadata 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 0077cf6..3e2e137 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,13 @@ [package] name = "wasm-pack" description = "pack up the wasm and publish it to npm!" -version = "0.4.2" +version = "0.5.0" authors = ["Ashley Williams "] repository = "https://github.com/ashleygwilliams/wasm-pack.git" license = "MIT/Apache-2.0" readme = "README.md" categories = ["wasm"] +documentation = "https://rustwasm.github.io/wasm-pack/" [dependencies] atty = "0.2.11" diff --git a/demo.gif b/demo.gif index 70d64f8..cadea89 100644 Binary files a/demo.gif and b/demo.gif differ