#!/bin/bash set -e echo "Building for WebAssembly..." # Install wasm-bindgen-cli if not present if ! command -v wasm-bindgen &> /dev/null; then echo "Installing wasm-bindgen-cli..." cargo install wasm-bindgen-cli fi # Build the project cargo build --release --target wasm32-unknown-unknown # Generate JS bindings wasm-bindgen --out-dir ./web --target web ./target/wasm32-unknown-unknown/release/flappy-bird-rust.wasm # Copy assets and HTML mkdir -p web/assets cp -r assets/* web/assets/ cp index.html web/ echo "Build complete! Files are in ./web" echo "To serve locally, run: python3 -m http.server --directory web 8080" echo "Then open http://localhost:8080"