The setup is based on this tutorial, but an excerpt follows below.
Install rust and then wasm-pack:
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | shInstall nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bashFollow any extra instructions from the script and restart your terminal. Then run:
nvm install v16.13.2
nvm useYou don't need to specify the version since it is set by the .nvmrc file.
Install npm and then run:
npm installTo start a web server that auto-reloads on changes, run:
npm startRun:
npm run start:distNote that you need Python 3.8 (2019 release) or newer, else the mime type won't be correct for the wasm content.
We release by pushing to the github pages branch with the help of the gh-pages package.
To publish/deploy run:
npm run deployRun all tests:
npm run test:nodeThat command is an alias for WASM_BINDGEN_TEST_TIMEOUT=60 wasm-pack test --node.
Or run a specific test file:
npm run test:node -- --test tier_0Install:
cargo install wasm-bindgen-cliRun with:
WASM_BINDGEN_TEST_TIMEOUT=60 cargo test --target wasm32-unknown-unknownWe use prettier for formatting. Please run the following before committing:
npx prettier --write .Or a faster version:
npx prettier \
$(git diff --name-only --diff-filter=ACM) \
$(git diff --cached --name-only --diff-filter=ACM) \
--write --ignore-unknown