Files
davila7__claude-code-templates/scripts/deploy.sh
Dani bf22ede1b2 chore: finish Vercel -> Cloudflare Pages migration docs and cleanup
The dashboard already deploys to Cloudflare Pages (deploy.yml, wrangler.toml)
but CLAUDE.md, the deployer/build-checker agents, and the dashboard/cloudflare
rules still described the old Vercel setup. The pulse worker still called the
Vercel API for deploy metrics even though the project moved off Vercel.

- Update CLAUDE.md, deployer.md, build-checker.md, dashboard.md, cloudflare.md
  to reflect Cloudflare Pages (wrangler deploy/rollback, CLOUDFLARE_API_TOKEN/
  CLOUDFLARE_ACCOUNT_ID secrets) instead of Vercel
- Apply an unmerged fix (55741ad4) that replaces pulse's Vercel deploy-metrics
  collector with a Cloudflare Pages collector
- Remove dead dashboard/vercel.json; port its security/CORS headers to
  dashboard/public/_headers (Cloudflare Pages' native headers file) since
  Cloudflare Pages was silently ignoring vercel.json
- Rewrite scripts/deploy.sh to call wrangler instead of vercel --prod
2026-06-30 21:03:54 -04:00

54 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Deploy script for claude-code-templates
# Deploys the Astro dashboard (Cloudflare Pages) which serves both
# www.aitmpl.com and app.aitmpl.com
#
# Required env vars (from .env):
# CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID
#
# Usage:
# ./scripts/deploy.sh # Deploy www + app.aitmpl.com
# ./scripts/deploy.sh dashboard # Same as above (backwards compat)
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
# Load .env if present
if [[ -f "$REPO_ROOT/.env" ]]; then
set -a
source "$REPO_ROOT/.env"
set +a
fi
# Validate required vars
for var in CLOUDFLARE_API_TOKEN CLOUDFLARE_ACCOUNT_ID; do
if [[ -z "${!var:-}" ]]; then
echo "Error: $var is not set. Add it to .env" >&2
exit 1
fi
done
deploy() {
echo "=> Building dashboard..."
npm --prefix "$REPO_ROOT/dashboard" install
npm --prefix "$REPO_ROOT/dashboard" run build
echo "=> Deploying www.aitmpl.com + app.aitmpl.com (Cloudflare Pages)..."
CLOUDFLARE_API_TOKEN="$CLOUDFLARE_API_TOKEN" \
CLOUDFLARE_ACCOUNT_ID="$CLOUDFLARE_ACCOUNT_ID" \
npx wrangler pages deploy "$REPO_ROOT/dashboard/dist" --project-name=aitmpl-dashboard --commit-dirty=true
echo "=> Deployed successfully."
}
case "${1:-}" in
""|dashboard|all)
deploy
;;
*)
echo "Usage: $0 [dashboard]"
echo ""
echo " Deploys the Astro dashboard serving www.aitmpl.com + app.aitmpl.com"
exit 1
;;
esac