#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT/frontend-app"
npm ci || npm install
npm run build
cd "$ROOT"
php tools/validate_environment.php --file=.env.staging || true
find app tools tests -name '*.php' -print0 | xargs -0 -n1 php -l >/dev/null
printf 'Staging build complete: %s\n' "$ROOT/public/app"
