#!/usr/bin/env bash # Qortal Hub: one flat app root with a real production index.html (never the Vite dev /src/ entry). # Stages the contents of dist/ first, then adds legacy app.js / style.css if present. set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" cd "$ROOT" npm run build T="$(mktemp -d "${TMPDIR:-/tmp}/qwb-portfolio-XXXX")" trap 'rm -rf "$T"' EXIT cp -a dist/. "$T"/ # dev.html in dist is a duplicate of the same bundle; drop so Hub only sees index.html + assets. rm -f "$T"/dev.html # Keep dist/site.html: the builder’s export + preview fetches it from the app root to build the visitor zip. # Optional legacy site bundle (separate from React dist) for f in app.js style.css; do if [[ -f "$ROOT/$f" ]]; then cp -a "$ROOT/$f" "$T"/ fi done # Root manifest can differ from public/; for Q-App, dist/manifest.json (main: index.html) is correct. # Prefer dist copy in archive (already in $T from cp -a dist). Do not override. DATE="$(date +%Y%m%d)" OUT="${ROOT}/Portfolio-Q-App-v3-${DATE}.zip" rm -f "$OUT" ( cd "$T" && zip -r -9 "$OUT" . ) echo "Created: $OUT" ls -la "$OUT"