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)
4set -euo pipefail
5cd "$(dirname "$0")"
6out="${OUT:-dist}"
7profile="${PROFILE:-release}"
8
9cargo build --target wasm32-unknown-unknown --profile "$profile"
10rm -rf "$out" && mkdir -p "$out"
11wasm-bindgen --target web --no-typescript --out-dir "$out/pkg" "target/wasm32-unknown-unknown/$profile/fission_web.wasm"
12cp index.html "$out/"
13echo "built $out/ -- serve with: python3 -m http.server -d $out 8080"