#!/usr/bin/env bash # Builds the page: the MoonBit program (web/*.mbt, js backend) plus its static files, # into dist/web/. With --demo the browser demo's apps.json and widgets.json come too; # the APK build leaves them out (the shell answers those URLs itself). set -euo pipefail cd "$(dirname "$0")/.." export PATH="$HOME/.moon/bin:$PATH" moon build --target js --release out=dist/web rm -rf "$out" && mkdir -p "$out" cp _build/js/release/build/web/web.js "$out/launcher.js" cp web/index.html web/style.css "$out/" if [ "${1:-}" = "--demo" ]; then cp web/apps.json web/widgets.json "$out/"; fi echo "built $out ($(wc -c < "$out/launcher.js") bytes of JS)"