Wasm-pack: Clarify intent of wasm-pack and commands

Created on 20 Dec 2018  路  4Comments  路  Source: rustwasm/wasm-pack

The description of wasm-pack in this repository:

wasm-pack helps you build and publish rust-generated WebAssembly to the npm registry to be used alongside any other javascript package in workflows that you already use, such as webpack or greenkeeper.

This seems to indicate wasm-pack is only used when publishing the output to a registry, but wasm-pack appears to be usable for other use cases. The front page at https://rustwasm.github.io/wasm-pack/ also doesn't contain many details which makes it difficult to understand the intended use cases. This is a bit confusing for users that don't want to publish to npm (for example, running wasm-pack build for internal use in their project).

I wanted to raise this here because rustwasm/wasm-bindgen#1120 mentioned that wasm-pack is an appropriate replacement for the example build scripts there. It seems to be working great and gives me the expected output, but I'm unsure if I'm misusing the CLI (Your wasm pkg is ready to publish at "/Users/josh/Projects/js-hello-world/pkg". even though I don't want to publish anything).

PR attached marketing question

Most helpful comment

hi @grovesNL ! you are absolutely correct- wasm-pack certainly doesn't require that you publish to the registry. originally, when we came up with wasm-pack it was indeed just a publishing tool- however it's since grown into an integrated build tool that does quite a bit more than was the original plan, and certainly doesn't require that folks publish.

i would welcome a PR to update the messaging if you're interested. i intend to get a release out today/tomorrow, and can also do some wordsmithing (and website improvement) :) thanks for filing!

All 4 comments

The commands section in the book describes the commands pretty well and does clarify that publishing is optional. So I guess there could be some improvements here:

  • Add more details about possible use cases for wasm-pack on both gh-pages and repository readme could be useful.
  • Maybe wasm-pack build should note that publishing is optional or rephrase the current message.
  • Describe how to setup a project to match the examples in wasm-bindgen. For example, whenever I run wasm-pack build the package.json is overwritten, so it's unclear how to add a serve script to the pkg/package.json without it being replaced each time. Maybe there's another way to do it but glancing through the documentation it wasn't obvious.

Let me know if there are established best practices already, I'd be happy to send a PR to try to clarify.

hi @grovesNL ! you are absolutely correct- wasm-pack certainly doesn't require that you publish to the registry. originally, when we came up with wasm-pack it was indeed just a publishing tool- however it's since grown into an integrated build tool that does quite a bit more than was the original plan, and certainly doesn't require that folks publish.

i would welcome a PR to update the messaging if you're interested. i intend to get a release out today/tomorrow, and can also do some wordsmithing (and website improvement) :) thanks for filing!

this is going to be handled partially by a PR in this repo and partially in a set of others! i'm closing because we'll file more granular issues for the to do items, thank you so much for this thoughtful issue! it was very helpful :)

Sounds great, thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

netgusto picture netgusto  路  4Comments

Bernd-L picture Bernd-L  路  3Comments

ishitatsuyuki picture ishitatsuyuki  路  5Comments

mgattozzi picture mgattozzi  路  4Comments

gliheng picture gliheng  路  3Comments