#!/usr/bin/env sh # Keep extracted/ a mirror of dist/ so Portfolio-style zips and local Hub tests # never point at stale hashed assets (grey screen + "Loading…" forever). set -e ROOT="$(cd "$(dirname "$0")/.." && pwd)" cd "$ROOT" # Vite entry is dev.html; build may emit dist/dev.html — copy to index.html for manifest + tools. if [ -f dist/dev.html ]; then cp -f dist/dev.html dist/index.html fi if [ ! -f dist/index.html ]; then echo "sync-extracted-from-dist: dist/index.html missing — run npm run build first" >&2 exit 1 fi rm -rf extracted mkdir -p extracted cp -a dist/. extracted/ # Replace repo `index.html` with the BUILT production entry. Earlier we shipped a redirect HTML, # but Qortal core injects q-apps.js into the file it actually serves. After a redirect the second # file may not receive the injection, so qortalRequest is never defined and Connect cannot work. # Vite dev still uses dev.html (kept untouched here). if [ -f dist/index.html ]; then cp -f dist/index.html index.html cp -f dist/index.html index.hub.html echo "sync-extracted-from-dist: wrote production index.html and index.hub.html" fi # Both index.html and index.hub.html load ./assets/…; mirror next to them for Portfolio zips. if [ -d dist/assets ]; then rm -rf assets cp -a dist/assets assets echo "sync-extracted-from-dist: wrote assets/ (Vite output — must ship next to index.html)" fi echo "sync-extracted-from-dist: copied dist/ → extracted/"