-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnetlify-build.sh
More file actions
76 lines (60 loc) · 1.69 KB
/
Copy pathnetlify-build.sh
File metadata and controls
76 lines (60 loc) · 1.69 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
#!/bin/bash
# Netlify Build Script for EthioHeritage360
# This script handles common build issues and ensures successful deployment
echo "🚀 Starting EthioHeritage360 Netlify Build"
echo "=========================================="
# Set error handling
set -e
# Print Node and NPM versions
echo "📊 Environment Info:"
echo "Node version: $(node --version)"
echo "NPM version: $(npm --version)"
echo "Current directory: $(pwd)"
# Check if client directory exists
if [ ! -d "client" ]; then
echo "❌ Error: client directory not found"
exit 1
fi
echo "📁 Client directory found"
# Navigate to client directory
cd client
# Check if package.json exists
if [ ! -f "package.json" ]; then
echo "❌ Error: client/package.json not found"
exit 1
fi
echo "📦 package.json found"
# Clean install dependencies
echo "🔄 Installing client dependencies..."
if npm ci --production=false; then
echo "✅ Dependencies installed successfully"
else
echo "⚠️ npm ci failed, trying npm install..."
npm install
fi
# Build the client
echo "🏗️ Building client application..."
if npm run build; then
echo "✅ Client build completed successfully"
else
echo "❌ Client build failed"
exit 1
fi
# Check if dist directory was created
if [ ! -d "dist" ]; then
echo "❌ Error: dist directory not created"
exit 1
fi
echo "📂 Build artifacts created in dist directory"
# List contents of dist directory
echo "📋 Build artifacts:"
ls -la dist/
# Check for required files
if [ -f "dist/index.html" ]; then
echo "✅ index.html found"
else
echo "❌ Error: index.html not found in dist"
exit 1
fi
echo "🎉 Netlify build completed successfully!"
echo "Build artifacts are ready in client/dist"