File size: 1,076 Bytes
ca28016
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/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/"