export: --dist builds both /ops and /shopdb frontend bases

Two instances run on the box (dev /ops + prod /shopdb); each needs its own
base-path build. Build both on every --dist so prod never ships a stale
frontend. tools/ is excluded from publication, so this is dev-tooling only.
This commit is contained in:
cproudlock
2026-07-28 08:28:42 -04:00
parent 67de46dfb9
commit f533af82cd

View File

@@ -8,7 +8,8 @@
#
# Usage:
# tools/export-github.sh "Commit message for the publication commit"
# tools/export-github.sh --dist # also rebuild the /ops frontend dist
# tools/export-github.sh --dist # also rebuild BOTH frontend dists
# # (/ops = dev, /shopdb = prod)
#
# This script lives in tools/, which is itself excluded from publication.
set -euo pipefail
@@ -111,13 +112,17 @@ git bundle create "$OUT/shopdb-flask-pub.bundle" HEAD main --tags
git bundle verify "$OUT/shopdb-flask-pub.bundle" >/dev/null
echo "bundle: $OUT/shopdb-flask-pub.bundle"
# --- 6. optional /ops dist for the prod server ---
# --- 6. optional per-instance dists (both bases: /ops = dev, /shopdb = prod) ---
# Two instances run on the box; each needs its own base-path build. Always
# rebuild BOTH so prod never ships a stale frontend.
if [ "$BUILD_DIST" = 1 ]; then
cd "$WORK/frontend"
VITE_BASE_PATH=/ops/ npm run build --silent
rm -rf "$OUT/frontend-dist-subpath-ops"
cp -r dist "$OUT/frontend-dist-subpath-ops"
echo "dist: $OUT/frontend-dist-subpath-ops/"
for base in ops shopdb; do
VITE_BASE_PATH=/$base/ npm run build --silent
rm -rf "$OUT/frontend-dist-subpath-$base"
cp -r dist "$OUT/frontend-dist-subpath-$base"
echo "dist: $OUT/frontend-dist-subpath-$base/ (base /$base/)"
done
fi
cat <<'EOF'