feat(docs): scaffold book for 3 tutorials

master
Ashley Williams 6 years ago
parent d5b12094e6
commit 5daca8cd5f
  1. 28
      docs/src/SUMMARY.md
  2. 1
      docs/src/tutorials/hybrid-applications-with-webpack/index.md
  3. 1
      docs/src/tutorials/index.md
  4. 24
      docs/src/tutorials/npm-browser-packages/building-your-package.md
  5. 0
      docs/src/tutorials/npm-browser-packages/getting-started.md
  6. 5
      docs/src/tutorials/npm-browser-packages/index.md
  7. 0
      docs/src/tutorials/npm-browser-packages/packaging-and-publishing.md
  8. 1
      docs/src/tutorials/npm-browser-packages/project-setup/index.md
  9. 1
      docs/src/tutorials/npm-browser-packages/project-setup/manual-setup.md
  10. 0
      docs/src/tutorials/npm-browser-packages/project-setup/project-setup/index.md
  11. 0
      docs/src/tutorials/npm-browser-packages/project-setup/project-setup/manual-setup.md
  12. 0
      docs/src/tutorials/npm-browser-packages/project-setup/project-setup/using-a-template.md
  13. 1
      docs/src/tutorials/npm-browser-packages/project-setup/using-a-template.md
  14. 0
      docs/src/tutorials/npm-browser-packages/template-deep-dive.md
  15. 1
      docs/src/tutorials/npm-browser-packages/template-deep-dive/building-your-project.md
  16. 0
      docs/src/tutorials/npm-browser-packages/template-deep-dive/cargo-toml.md
  17. 0
      docs/src/tutorials/npm-browser-packages/template-deep-dive/index.md
  18. 0
      docs/src/tutorials/npm-browser-packages/template-deep-dive/src-lib-rs.md
  19. 0
      docs/src/tutorials/npm-browser-packages/template-deep-dive/src-utils-rs.md
  20. 0
      docs/src/tutorials/npm-browser-packages/using-your-library.md
  21. 1
      docs/src/tutorials/standalone-wasm-binaries/index.md

@ -2,22 +2,26 @@
- [Prerequisites](./prerequisites/index.md)
- [npm (optional)](./prerequisites/npm.md)
- [Project Setup](./project-setup/index.md)
- [Using a Template](./project-setup/using-a-template.md)
- [Manual Setup](./project-setup/manual-setup.md)
- [Commands](./commands/index.md)
- [`init` (DEPRECATED)](./commands/init.md)
- [`build`](./commands/build.md)
- [`test`](./commands/test.md)
- [`pack` and `publish`](./commands/pack-and-publish.md)
- [Tutorial](./tutorial/index.md)
- [Getting Started](./tutorial/getting-started.md)
- [Template Deep Dive](./tutorial/template-deep-dive/index.md)
- [`Cargo.toml`](./tutorial/template-deep-dive/cargo-toml.md)
- [`src/lib.rs`](./tutorial/template-deep-dive/src-lib-rs.md)
- [`src/utils.rs`](./tutorial/template-deep-dive/src-utils-rs.md)
- [`wee_alloc`](./tutorial/template-deep-dive/wee_alloc.md)
- [Packaging and Publishing](./tutorial/packaging-and-publishing.md)
- [Using your Library](./tutorial/using-your-library.md)
- [Tutorials](./tutorials/index.md)
- [Hybrid applications with Webpack](./tutorials/hybrid-applications-with-webpack/index.md)
- [npm browser packages](./tutorials/npm-browser-packages/index.md)
- [Getting started](./tutorials/npm-browser-packages/getting-started.md)
- [Project setup](./tutorials/npm-browser-packages/project-setup/index.md)
- [Using a Template](./tutorials/npm-browser-packages/project-setup/using-a-template.md)
- [Manual Setup](./tutorials/npm-browser-packages/project-setup/manual-setup.md)
- [Template deep dive](./tutorials/npm-browser-packages/template-deep-dive/index.md)
- [`Cargo.toml`](./tutorials/npm-browser-packages/template-deep-dive/cargo-toml.md)
- [`src/lib.rs`](./tutorials/npm-browser-packages/template-deep-dive/src-lib-rs.md)
- [`src/utils.rs`](./tutorials/npm-browser-packages/template-deep-dive/src-utils-rs.md)
- [`wee_alloc`](./tutorial/template-deep-dive/wee_alloc.md)
- [Building your project](./tutorials/npm-browser-packages/template-deep-dive/building-your-project.md)
- [Packaging and publishing](./tutorials/npm-browser-packages/packaging-and-publishing.md)
- [Using your library](./tutorials/npm-browser-packages/using-your-library.md)
- [Standalone WASM binaries](./tutorials/standalone-wasm-binaries/index.md)
- [`Cargo.toml` Configuration](./cargo-toml-configuration.md)
- [Contributing](./contributing.md)

@ -0,0 +1,24 @@
# Building your package
We've written our code so now we need to package it all up.
We are writing a package that should be used in the browser, so we run this in our terminal:
```bash
$ wasm-pack build --scope MYSCOPE
```
If you were writing a package that should be used in Node.js (with CommonJS modules, e.g. `require`),
you would run this in your terminal:
```bash
$ wasm-pack build --scope MYSCOPE --target nodejs
```
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
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,6 +1,7 @@
# Tutorial
# npm Browser Package Tutorial
The goal of this tutorial is to introduce you to the `wasm-pack` workflow.
The goal of this tutorial is to introduce you to the `wasm-pack` workflow by building a small npm
package designed to be used in a broswer application.
This tutorial is aimed at folks who are both beginners to WebAssembly and Rust- you don't need
much Rust knowledge to complete this tutorial.
Loading…
Cancel
Save