#!/usr/bin/env bash # Deploy builder source from the dev workspace to the runtime location on the Mac mini. # Usage: ./bin/deploy.sh set -euo pipefail DEV_DIR="$(cd "$(dirname "$0")/.." && pwd)" RUN_DIR="/Users/m4mini/AppStoreBuilder/app" echo "Deploying builder from $DEV_DIR → $RUN_DIR" rsync -a \ --exclude node_modules \ --exclude data \ --exclude .env \ --exclude bin/deploy.sh \ "$DEV_DIR/" "$RUN_DIR/" # Install/refresh deps if package.json changed if ! cmp -s "$DEV_DIR/package.json" "$RUN_DIR/package.json.last" 2>/dev/null; then (cd "$RUN_DIR" && npm install --production) cp "$DEV_DIR/package.json" "$RUN_DIR/package.json.last" fi # Restart the launchd service UID_NUM=$(id -u) if launchctl print "gui/$UID_NUM/com.88oak.appstorebuilder" >/dev/null 2>&1; then launchctl kickstart -k "gui/$UID_NUM/com.88oak.appstorebuilder" echo "Service kickstarted" else echo "Service not loaded — bootstrap it with:" echo " launchctl bootstrap gui/$UID_NUM ~/Library/LaunchAgents/com.88oak.appstorebuilder.plist" fi sleep 1 curl -s http://localhost:3090/api/health && echo ""