#!/usr/bin/env bash set -euo pipefail if [[ $# -ne 1 || "$1" != /opt/kangshifu-web ]]; then echo 'Usage: bash scripts/deploy-board-local.sh /opt/kangshifu-web' >&2 exit 2 fi : "${KSF_DEPLOY_AUTH_FILE:?Set this to the existing private application deployment JSON; never put a key on the command line}" cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." umask 022 node -e 'if(Number(process.versions.node.split(".")[0])<20)process.exit(1)' results_dir="$(mktemp -d /opt/ksf-board-local-20261111-results-XXXXXXXX)" node scripts/preflight-mime-mjs.mjs --origin https://kangshifu.fmode.cn --target-dir "$1" | tee "$results_dir/mime-preflight.json" node --test test/board-local-deploy.test.mjs test/mjs-mime-preflight.test.mjs | tee "$results_dir/deploy-tests.txt" node scripts/deploy-board-member-roster.mjs plan | tee "$results_dir/member-plan.json" node scripts/publish-board-local.mjs --target-dir "$1" | tee "$results_dir/frontend-plan.json" node scripts/deploy-board-member-roster.mjs apply | tee "$results_dir/member-apply.json" node scripts/publish-board-local.mjs --target-dir "$1" --apply | tee "$results_dir/frontend-apply.json" node scripts/publish-board-local.mjs --target-dir "$1" | tee "$results_dir/frontend-noop.json" node scripts/deploy-board-member-roster.mjs plan | tee "$results_dir/member-noop.json" node scripts/verify-board-local-public.mjs | tee "$results_dir/public-verification.json" node scripts/verify-modules.mjs https://kangshifu.fmode.cn/ --json | tee "$results_dir/module-verification.json" echo "Deployment and public read checks complete. Browser acceptance remains required. Receipts: $results_dir"