-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
126 lines (106 loc) Β· 3.27 KB
/
setup.sh
File metadata and controls
126 lines (106 loc) Β· 3.27 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash
# π PPTX Translator Pro - Automatic Setup Script
# Bartosz Idzik Enterprise Ecosystem
echo "π PPTX Translator Pro - Setup Started"
echo "β° Current Time: $(date '+%H:%M')"
echo ""
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
# Check if Node.js is installed
print_status "Checking Node.js installation..."
if ! command -v node &> /dev/null; then
print_error "Node.js is not installed!"
echo "Please install Node.js from: https://nodejs.org/"
echo "Recommended version: 18.x or higher"
exit 1
fi
NODE_VERSION=$(node --version)
print_success "Node.js found: $NODE_VERSION"
# Check if npm is installed
if ! command -v npm &> /dev/null; then
print_error "npm is not installed!"
exit 1
fi
NPM_VERSION=$(npm --version)
print_success "npm found: $NPM_VERSION"
# Clean previous installations
print_status "Cleaning previous installations..."
rm -rf node_modules
rm -f package-lock.json
# Install dependencies with specific flags to avoid conflicts
print_status "Installing dependencies..."
print_warning "This may take 2-3 minutes..."
# Use --legacy-peer-deps to avoid dependency conflicts
npm install --legacy-peer-deps --no-optional
if [ $? -eq 0 ]; then
print_success "β
Dependencies installed successfully!"
else
print_error "β Failed to install dependencies"
echo ""
print_status "Trying alternative installation method..."
# Try with yarn if available
if command -v yarn &> /dev/null; then
print_status "Using Yarn as fallback..."
yarn install --ignore-engines
else
# Try with --force flag
print_status "Retrying with --force flag..."
npm install --force --legacy-peer-deps
fi
fi
# Create .env file if it doesn't exist
if [ ! -f .env ]; then
print_status "Creating .env file..."
cat > .env << EOL
# PPTX Translator Pro Environment Variables
VITE_APP_NAME="PPTX Translator Pro"
VITE_APP_VERSION="1.0.0"
VITE_GOOGLE_API_ENABLED=false
VITE_MOCK_MODE=true
EOL
print_success ".env file created"
fi
# Check if build works
print_status "Testing build process..."
npm run build
if [ $? -eq 0 ]; then
print_success "β
Build test successful!"
else
print_warning "β οΈ Build test failed, but app should still work in development"
fi
echo ""
echo "π Setup Complete!"
echo ""
echo "π Next Steps:"
echo "1. Start development server: ${GREEN}npm run dev${NC}"
echo "2. Open browser to: ${BLUE}http://localhost:5173${NC}"
echo "3. For deployment: ${YELLOW}npm run deploy${NC}"
echo ""
echo "π Deployment Options:"
echo "β’ Netlify: Push to GitHub β Connect β Deploy"
echo "β’ Vercel: Import GitHub repo β Auto-deploy"
echo "β’ Manual: npm run build β upload 'dist' folder"
echo ""
echo "π Troubleshooting:"
echo "β’ If dependencies fail: ${YELLOW}npm install --force --legacy-peer-deps${NC}"
echo "β’ If build fails: ${YELLOW}npm run build -- --emptyOutDir${NC}"
echo "β’ For help: Check README.md"
echo ""
print_success "Ready to go! π"