Significant changes to clean things up and improve the user UX #144
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here is a high-level list of all the changes:
Separates the rust-webpack-template files from the user files (user files are in the
template
folder).This has a couple of benefits, the biggest is that the user no longer has a ton of unneeded files spewed into their project.
The other big benefit is that it lets us tailor things for the template: e.g. having a different
package.json
, differentauthor
, differentREADME
, etc.I updated everything to be custom-tailored to the template (e.g. the README, name, author, dependencies, etc.)
It has a smoother "out of the box" experience: when using
npm start
everything is run in debug mode, andconsole_error_panic_hook
is automatically enabled.Then when using
npm run build
it runs in release mode andconsole_error_panic_hook
is automatically disabled.It now puts the
index.html
file into thestatic
folder, and usescopy-webpack-plugin
to copy thestatic
folder into thedist
folder.What that means is that the user can now put any files they want into the
static
folder and they will be copied as-is into thedist
folder when building. This can be very useful for including static resources like.css
files.It enables
lto
when in release mode.The template now includes unit testing, so it's easy for the user to create unit tests. In addition there's now an
npm test
command to run the tests.It now uses
wasm_bindgen(start)
which is more idiomatic, and it also handles errors better when loading the.js
file.The template directory now follows the standard Rust idioms (
Cargo.toml
andsrc
at top level).It uses
rimraf
to delete thedist
andpkg
folders, ensuring that it doesn't contain any stale files.It now makes it a lot easier to enable
wee_alloc
if the user chooses to do so (it's still disabled by default).It does a shallow clone of the rust-webpack-template git, which makes the cloning a lot faster.
It's probably easiest to review the changes by looking at the entire repo, rather than the diffs.
After this is merged, the tutorial will need to be updated as well.
Fixes #27