From 212d7727dcddf5c091235389a1c7689fe20348b7 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 10 Jan 2019 16:43:03 -0800 Subject: [PATCH 1/3] docs: use `wasm-pack build` instead of `wasm-pack init` The latter has been deprecated for some time. --- docs/src/commands/pack-and-publish.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/commands/pack-and-publish.md b/docs/src/commands/pack-and-publish.md index 849fb3a..ccc003c 100644 --- a/docs/src/commands/pack-and-publish.md +++ b/docs/src/commands/pack-and-publish.md @@ -1,7 +1,7 @@ # pack and publish The `publish` and `pack` commands interact with the pkg directory that's -created when you run `wasm-pack init`. The `pack` command creates a tarball +created when you run `wasm-pack build`. The `pack` command creates a tarball from the pkg directory and the `publish` command creates a tarball from the pkg directory __and__ publishes it to the NPM registry. From ecbdf90adc902425c8cd907fc9963c1dd20cc44c Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 10 Jan 2019 16:43:29 -0800 Subject: [PATCH 2/3] docs: delete trailing whitespace --- docs/src/commands/pack-and-publish.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/src/commands/pack-and-publish.md b/docs/src/commands/pack-and-publish.md index ccc003c..0a9a4f7 100644 --- a/docs/src/commands/pack-and-publish.md +++ b/docs/src/commands/pack-and-publish.md @@ -1,9 +1,9 @@ # pack and publish -The `publish` and `pack` commands interact with the pkg directory that's +The `publish` and `pack` commands interact with the pkg directory that's created when you run `wasm-pack build`. The `pack` command creates a tarball -from the pkg directory and the `publish` command creates a tarball from the -pkg directory __and__ publishes it to the NPM registry. +from the pkg directory and the `publish` command creates a tarball from the +pkg directory __and__ publishes it to the NPM registry. Underneath, these commands use `npm pack` and `npm publish`. You can read more about these in the NPM documentation: @@ -11,8 +11,8 @@ more about these in the NPM documentation: - [`npm pack`](https://docs.npmjs.com/cli/pack) - [`npm publish`](https://docs.npmjs.com/cli/publish) -Both these commands take the path to the pkg directory as the first argument. -You can either set the argument directly to the pkg directory or to the parent +Both these commands take the path to the pkg directory as the first argument. +You can either set the argument directly to the pkg directory or to the parent of the pkg directory: ``` From 20c488d559dc00387448a3b651fa36c569dbd967 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 10 Jan 2019 16:56:44 -0800 Subject: [PATCH 3/3] docs: document that the `pkg` directory is gitignored by default Fixes #473 --- docs/src/commands/build.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/src/commands/build.md b/docs/src/commands/build.md index 884963b..2305f50 100644 --- a/docs/src/commands/build.md +++ b/docs/src/commands/build.md @@ -5,6 +5,10 @@ interoperability and for publishing a package to npm. This involves compiling your code to wasm and generating a pkg folder. This pkg folder will contain the wasm binary, a JS wrapper file, your `README`, and a `package.json` file. +The `pkg` directory is automatically `.gitignore`d by default, since it contains +build artifacts which are not intended to be checked into version +control.[0](#footnote-0) + ## Path The `wasm-pack build` command can be given an optional path argument, e.g.: @@ -85,3 +89,9 @@ wasm-pack build examples/js-hello-world --mode no-install |---------------|------------------------------------------------------------------------------------------| | `no-install` | `wasm-pack init` implicitly and create wasm binding without installing `wasm-bindgen`. | | `normal` | do all the stuffs of `no-install` with installed `wasm-bindgen`. | + +
+ +0 If you need to include additional assets in the pkg +directory and your NPM package, we intend to have a solution for your use case +soon. [↩](#wasm-pack-build)