28 lines
830 B
Bash
28 lines
830 B
Bash
#!/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
|
||
|
|
echo "Flutter will serve this at http://localhost:8080 via InAppLocalhostServer."
|
||
|
|
echo "Remember to run 'flutter pub get' if pubspec assets changed."
|