Skip to content

Significant changes to clean things up and improve the user UX #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 11, 2019

Conversation

Pauan
Copy link
Contributor

@Pauan Pauan commented Jun 8, 2019

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, different author, different README, 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, and console_error_panic_hook is automatically enabled.

    Then when using npm run build it runs in release mode and console_error_panic_hook is automatically disabled.

  • It now puts the index.html file into the static folder, and uses copy-webpack-plugin to copy the static folder into the dist 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 the dist 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 and src at top level).

  • It uses rimraf to delete the dist and pkg 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

Copy link
Member

@sendilkumarn sendilkumarn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Pauan 👍 for the changes. I really like this.

Can you also please rebase the changes?

Also was wondering have you seen this already >>

Might be we can use that.

@Pauan Pauan force-pushed the cleanup branch 2 times, most recently from 5b9ddd8 to 7c63321 Compare June 11, 2019 12:45
@Pauan
Copy link
Contributor Author

Pauan commented Jun 11, 2019

@sendilkumarn I rebased.

I wouldn't mind switching from npm init to GitHub templates, but that's not my decision to make (and it should probably be done in a different PR).

@sendilkumarn
Copy link
Member

@Pauan Of course yes, My suggestion was we can also try that. But for this PR, let us merge this. Thanks for the PR @Pauan 👍

@sendilkumarn sendilkumarn merged commit 5dfc7d6 into rustwasm:master Jun 11, 2019
@Pauan Pauan deleted the cleanup branch June 11, 2019 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove .git directory after cloning or download instead of cloning
2 participants