2026-10-24 13:20:55 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
# Build the Rust WASM engine + React frontend, then bundle the production build
|
|
|
|
|
# into assets/web/ so the Flutter InAppLocalhostServer can serve it inside the app.
|
|
|
|
|
#
|
|
|
|
|
# Run from anywhere: ./scripts/build_web.sh
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
|
cd "$ROOT"
|
|
|
|
|
|
|
|
|
|
echo "==> Building Rust WASM (wasm-pack, target web)"
|
|
|
|
|
( cd wasm && wasm-pack build --target web )
|
|
|
|
|
|
|
|
|
|
echo "==> Building React frontend (vite)"
|
|
|
|
|
( cd wasm/frontend && npm run build )
|
|
|
|
|
|
|
|
|
|
echo "==> Bundling dist/ -> assets/web/"
|
|
|
|
|
rm -rf assets/web
|
|
|
|
|
mkdir -p assets/web
|
|
|
|
|
cp -R wasm/frontend/dist/. assets/web/
|
|
|
|
|
|
|
|
|
|
echo "==> Done. assets/web/ contents:"
|
|
|
|
|
ls -la assets/web
|
|
|
|
|
|
|
|
|
|
echo
|
2026-10-25 07:11:03 +01:00
|
|
|
echo "Flutter will serve this at http://localhost:47391 (lib/local_server.dart)."
|
2026-10-24 13:20:55 +02:00
|
|
|
echo "Remember to run 'flutter pub get' if pubspec assets changed."
|