-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate wasm example to trunk (#844)
## Description This PR migrates the wasm example from an npm/webpack based approach to [trunk](https://trunkrs.dev/). Fixes #834. Of note: the `console_error_panic_hook` dependency was gated in `Cargo.toml` via `[target."cfg(debug_assertions)".dependencies]`. This is documented as nonfunctional and will throw a warning on build: ``` warning: Found `debug_assertions` in `target.'cfg(...)'.dependencies`. This value is not supported for selecting dependencies and will not work as expected. To learn more visit https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies ``` Since the actual usage of `console_error_panic_hook` is *also* gated in `lib.rs` behind `#[cfg(debug_assertions)]` it didn't make sense to have the cargo gate in place, hence I have removed it. ## Next steps If this PR is merged, the [wiki page](https://github.com/RustAudio/cpal/wiki/Setting-up-a-new-CPAL-WASM-project) linked in the root README should be updated as well.
- Loading branch information
1 parent
bdbbf75
commit db04f57
Showing
8 changed files
with
52 additions
and
6,994 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
Cargo.lock | ||
node_modules | ||
/dist | ||
/target | ||
/pkg | ||
/wasm-pack.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,28 @@ | ||
## How to install | ||
|
||
[trunk](https://trunkrs.dev/) is used to build and serve the example. | ||
```sh | ||
npm install | ||
cargo install --locked trunk | ||
# -- or -- | ||
cargo binstall trunk | ||
``` | ||
|
||
## How to run in debug mode | ||
|
||
```sh | ||
# Builds the project and opens it in a new browser tab. Auto-reloads when the project changes. | ||
npm start | ||
trunk serve --open | ||
``` | ||
|
||
## How to build in release mode | ||
|
||
```sh | ||
# Builds the project and places it into the `dist` folder. | ||
npm run build | ||
# Builds the project in release mode and places it into the `dist` folder. | ||
trunk build --release | ||
``` | ||
|
||
## What does each file do? | ||
|
||
* `Cargo.toml` contains the standard Rust metadata. You put your Rust dependencies in here. You must change this file with your details (name, description, version, authors, categories) | ||
|
||
* `package.json` contains the standard npm metadata. You put your JavaScript dependencies in here. You must change this file with your details (author, name, version) | ||
|
||
* `webpack.config.js` contains the Webpack configuration. You shouldn't need to change this, unless you have very special needs. | ||
|
||
* The `src` folder contains your Rust code. |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.