From da38f0a8fa06d6a7fe15dc56f3c78bda42c36400 Mon Sep 17 00:00:00 2001 From: data-pup Date: Sat, 25 Aug 2018 15:45:36 -0400 Subject: [PATCH] Edits to `packaging-and-publishing` tutorial step. --- docs/src/tutorial/packaging-and-publishing.md | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/docs/src/tutorial/packaging-and-publishing.md b/docs/src/tutorial/packaging-and-publishing.md index adf6912c..90af7f1f 100644 --- a/docs/src/tutorial/packaging-and-publishing.md +++ b/docs/src/tutorial/packaging-and-publishing.md @@ -1,37 +1,36 @@ # Package Code for npm -We've made our code so now we need to package it all up. In your project directory run the following +We have written our code, so now we need to package it all up. In your project directory run the following command: ```bash -$ wasm-pack init --scope MYSCOPE +$ wasm-pack build --scope MYSCOPE ``` -where `MYSCOPE` is your npm username. Normally you could just type `wasm-pack init` but since -other people are doing this tutorial as well we don't want conflicts with the `wasm-add` package +where `MYSCOPE` is your npm username. Normally you could just type `wasm-pack build`, but since +other people are doing this tutorial as well, we don't want conflicts with the `wasm-add` package name! This command when run does a few things: -1. It'll compile your code to wasm if you haven't already -2. It'll generate a pkg folder with the wasm file, a JS wrapper file around the wasm, your README, - and a `package.json` file. +1. It will compile your code to wasm if you have not already. +2. It will generate an output folder containing the wasm file, a JS wrapper file around the wasm, your README, + and a `package.json` file. This folder is named `pkg` by default, but can be specified using the `--out-dir` option. This is everything you need to upload your code to npm! Let's do just that! -First off you'll need to login to npm with the account you made earlier if you didn't already have -one: +First off, you will need to login to npm with the account you made earlier: ```bash $ npm login ``` -Next you'll need to go into the `pkg` directory and actually upload the package: +Next you will need to go into the output directory and actually upload the package: ```bash $ cd pkg $ npm publish --access=public ``` -Now normally if things are not scoped you can just do `npm publish` but if you give it a scope -you'll need to tell npm that this is actually public so it can publish it. We need to do that here -since we gave our packages a scope to avoid conflicting with each other! Next up is actually running +Normally if things are not scoped you can just do `npm publish`, but if you give it a scope +you will need to tell npm that this is actually public so that it can be published. We need to do that here +because we gave our packages a scope to avoid conflicting with each other! Next up is actually running the code and verifying we got it from npm and how we can use that code.