forked from Rathore-Rajpal/Superbot-Demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-vercel.sh
More file actions
97 lines (79 loc) · 2.34 KB
/
deploy-vercel.sh
File metadata and controls
97 lines (79 loc) · 2.34 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
echo "🚀 Deploying to Vercel with Error Prevention..."
# Clean up any existing .vercel directory to prevent conflicts
if [ -d ".vercel" ]; then
echo "🧹 Removing existing .vercel directory..."
rm -rf .vercel
fi
# Clean previous build
echo "🧹 Cleaning previous build..."
rm -rf dist
# Install dependencies
echo "📦 Installing dependencies..."
npm install
# Install terser if not present
if ! npm list terser > /dev/null 2>&1; then
echo "📦 Installing terser..."
npm install terser --save-dev
fi
# Build the project
echo "🔨 Building project..."
npm run build
# Check if build was successful
if [ ! -d "dist" ]; then
echo "❌ Build failed! dist directory not found."
exit 1
fi
echo "✅ Build completed successfully!"
echo "📁 Build output:"
ls -la dist/
# Check for common Vercel issues
echo "🔍 Checking for common Vercel issues..."
# Check if vercel.json is valid
if [ -f "vercel.json" ]; then
echo "✅ vercel.json found"
# Check for mixed routing properties
if grep -q '"routes"' vercel.json && (grep -q '"headers"' vercel.json || grep -q '"rewrites"' vercel.json); then
echo "❌ Mixed routing properties detected in vercel.json"
echo " This will cause deployment errors. Please fix vercel.json"
exit 1
fi
else
echo "⚠️ No vercel.json found - using default Vercel configuration"
fi
# Check for conflicting files
if [ -f "now.json" ]; then
echo "❌ Conflicting now.json found - please remove it"
exit 1
fi
if [ -d ".now" ]; then
echo "❌ Conflicting .now directory found - please remove it"
exit 1
fi
echo "✅ No configuration conflicts detected"
# Deploy to Vercel
echo "🚀 Deploying to Vercel..."
echo "📋 Deployment options:"
echo " 1. Deploy to production (--prod)"
echo " 2. Deploy to preview"
echo " 3. Just build and exit"
read -p "Choose option (1-3): " choice
case $choice in
1)
echo "🚀 Deploying to production..."
vercel --prod
;;
2)
echo "🚀 Deploying to preview..."
vercel
;;
3)
echo "✅ Build completed. Ready for manual deployment."
echo "📁 Upload the 'dist' folder contents to your hosting platform."
;;
*)
echo "❌ Invalid choice. Exiting."
exit 1
;;
esac
echo "✅ Deployment process completed!"