#!/usr/bin/env bash
# Builds the React frontend and assembles deploy/public_html/ — the folder whose
# CONTENTS you upload into your cPanel public_html.
set -e
cd "$(dirname "$0")"

echo "==> Building frontend (web/)…"
cd web
npm install
npm run build
cd ..

echo "==> Assembling deploy/public_html/…"
rm -rf deploy/public_html
mkdir -p deploy/public_html
cp -r web/dist/. deploy/public_html/
cp -r api deploy/public_html/api

echo ""
echo "Done."
echo "  1) Upload the CONTENTS of deploy/public_html/  ->  your cPanel public_html/"
echo "  2) Fill in private/angel_config.sample.php, rename to angel_config.php,"
echo "     and place it ONE LEVEL ABOVE public_html (e.g. /home/USER/private/)."
echo "  3) See README.md for the rest (HTTPS, Directory Privacy, token resolve)."
