| 1 | #!/usr/bin/env bash |
| 2 | # Builds the browser app into crates/web/dist (override with OUT=...), ready to serve statically. |
| 3 | # needs: rustup target add wasm32-unknown-unknown; wasm-bindgen-cli 0.2.128 (cargo install wasm-bindgen-cli --version 0.2.128) |
| 4 | set -euo pipefail |
| 5 | cd "$(dirname "$0")" |
| 6 | out="${OUT:-dist}" |
| 7 | profile="${PROFILE:-release}" |
| 8 | |
| 9 | cargo build --target wasm32-unknown-unknown --profile "$profile" |
| 10 | rm -rf "$out" && mkdir -p "$out" |
| 11 | wasm-bindgen --target web --no-typescript --out-dir "$out/pkg" "target/wasm32-unknown-unknown/$profile/fission_web.wasm" |
| 12 | cp index.html "$out/" |
| 13 | echo "built $out/ -- serve with: python3 -m http.server -d $out 8080" |