rustwasm / book

The Rust and WebAssembly Book
https://rustwasm.github.io/docs/book/
MIT License
1.73k stars 208 forks source link

add template installation and update usage steps #138

Closed pragyandas closed 5 years ago

pragyandas commented 5 years ago

Summary

Explain the motivation for making this change. What existing problem does the pull request solve? 🤔

In section Putting it into a Web Page:

fitzgen commented 5 years ago

npm init will install and run create-wasm-app for you -- I'm not sure I understand the motivation here. Can you explain a bit more?

pragyandas commented 5 years ago

npm init is used to create an empty node project. The create-wasm-app is a template which needs to be installed globally before using it. Moreover, making create-wasm-app available in the PATH makes it convinient to use everywhere (thereby making it semantically better).

fitzgen commented 5 years ago

npm init is used to create an empty node project.

npm init will also optionally use a create-* template script to initialize a new project, which is what we are doing here.

The create-wasm-app is a template which needs to be installed globally before using it.

That's not true: npm init foo will automatically download and run the create-foo package for you, and it doesn't already need to be installed globally or be on your $PATH.


I'm inclined to close this PR unless I am completely missing something.

pragyandas commented 5 years ago

The command described in the book didn't work for me, but the steps that I have added/updated work. If there is no issue with the steps (or if it is unique to me) I think we can close the PR.

fitzgen commented 5 years ago

Do you have the most up-to-date npm, as described here? https://rustwasm.github.io/book/game-of-life/setup.html#npm

I have

$ npm --version
6.2.0

The npm init docs also show off using create-* templates here: https://docs.npmjs.com/cli/init#examples

fitzgen commented 5 years ago

I am pretty sure this is just an old npm version, so I'm going to close this issue, and if updating your npm doesn't solve your problems, we can reopen. Thanks!