#!/bin/bash echo "🚀 Safe Deployment Script for Aether AI™" echo "==================================" # Set memory limits to prevent crashes export NODE_OPTIONS="--max-old-space-size=1024" # Check if we're in the right directory if [ ! -f "package.json" ]; then echo "❌ Error: Not in project directory. Run from project root." exit 1 fi # Step 1: Clean install (lighter) echo "📦 Installing dependencies (production only)..." npm ci --only=production --silent # Step 2: Build with memory limits (safer) echo "🏗️ Building project with memory limits..." npm run build:safe if [ $? -ne 0 ]; then echo "❌ Build failed. Trying even safer build..." NODE_OPTIONS="--max-old-space-size=512" npm run build --no-lint if [ $? -ne 0 ]; then echo "❌ Build failed. System may need more memory. Try closing other apps." exit 1 fi fi # Step 3: Deploy to Vercel (safer) echo "🌐 Deploying to Vercel..." npx vercel --prod --yes echo "✅ Deployment complete!" echo "📝 Next: Set up tunnel for backend at https://ngrok.com/"