-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.bat
More file actions
163 lines (148 loc) · 5.87 KB
/
setup.bat
File metadata and controls
163 lines (148 loc) · 5.87 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
@echo off
REM ==========================================
REM Web Compiler - Quick Start Setup (Windows) - Colorized Lines
REM ==========================================
setlocal
REM Force Node.js folder first in PATH
set "PATH=C:\Program Files\nodejs;%PATH%"
REM -----------------------------
REM Helper functions for colored echo
REM -----------------------------
set "PSGREEN=powershell -Command "Write-Host %* -ForegroundColor Green""
set "PSYELLOW=powershell -Command "Write-Host %* -ForegroundColor Yellow""
set "PSRED=powershell -Command "Write-Host %* -ForegroundColor Red""
REM -----------------------------
REM Header
REM -----------------------------
powershell -Command "Write-Host '==========================================' -ForegroundColor Cyan"
powershell -Command "Write-Host ' Web Compiler - Quick Start Setup' -ForegroundColor Cyan"
powershell -Command "Write-Host '==========================================' -ForegroundColor Cyan"
echo.
REM -----------------------------
REM Check Node.js
REM -----------------------------
powershell -Command "Write-Host '[STEP] Checking Node.js...' -ForegroundColor Yellow"
call node --version
if errorlevel 1 (
powershell -Command "Write-Host '[ERROR] Node.js is not installed' -ForegroundColor Red"
echo Install from: https://nodejs.org/en/
pause
exit /b 1
)
for /f "tokens=*" %%i in ('node --version') do set NODE_VERSION=%%i
powershell -Command "Write-Host '[OK] Node.js %NODE_VERSION%' -ForegroundColor Green"
echo.
REM -----------------------------
REM Check npm
REM -----------------------------
powershell -Command "Write-Host '[STEP] Checking npm...' -ForegroundColor Yellow"
call npm --version
if errorlevel 1 (
powershell -Command "Write-Host '[ERROR] npm is not installed or not accessible' -ForegroundColor Red"
pause
exit /b 1
)
for /f "tokens=*" %%i in ('npm --version') do set NPM_VERSION=%%i
powershell -Command "Write-Host '[OK] npm %NPM_VERSION%' -ForegroundColor Green"
echo.
REM -----------------------------
REM Check Docker
REM -----------------------------
powershell -Command "Write-Host '[STEP] Checking Docker...' -ForegroundColor Yellow"
call docker --version
if errorlevel 1 (
powershell -Command "Write-Host '[ERROR] Docker is not installed' -ForegroundColor Red"
echo Install from: https://www.docker.com/products/docker-desktop
pause
exit /b 1
)
for /f "tokens=*" %%i in ('docker --version') do set DOCKER_VERSION=%%i
powershell -Command "Write-Host '[OK] %DOCKER_VERSION%' -ForegroundColor Green"
echo.
REM Check Docker daemon
docker ps >nul 2>&1
if errorlevel 1 (
powershell -Command "Write-Host '[ERROR] Docker daemon is not running' -ForegroundColor Red"
echo Please start Docker Desktop and try again
pause
exit /b 1
)
powershell -Command "Write-Host '[OK] Docker daemon is running' -ForegroundColor Green"
echo.
REM -----------------------------
REM Setup Backend
REM -----------------------------
powershell -Command "Write-Host '[STEP] Setting up backend...' -ForegroundColor Yellow"
cd backend || exit /b 1
if not exist "node_modules" (
powershell -Command "Write-Host 'Installing backend dependencies...' -ForegroundColor Yellow"
call npm install
if errorlevel 1 (
powershell -Command "Write-Host '[ERROR] Failed to install backend dependencies' -ForegroundColor Red"
pause
exit /b 1
)
powershell -Command "Write-Host '[OK] Backend dependencies installed' -ForegroundColor Green"
) else (
powershell -Command "Write-Host '[OK] Backend dependencies already installed' -ForegroundColor Green"
)
if not exist ".env" (
copy .env.example .env
powershell -Command "Write-Host '[OK] Created .env from template' -ForegroundColor Green"
)
cd ..
echo.
REM -----------------------------
REM Setup Frontend
REM -----------------------------
powershell -Command "Write-Host '[STEP] Setting up frontend...' -ForegroundColor Yellow"
cd frontend || exit /b 1
if not exist "node_modules" (
powershell -Command "Write-Host 'Installing frontend dependencies...' -ForegroundColor Yellow"
call npm install
if errorlevel 1 (
powershell -Command "Write-Host '[ERROR] Failed to install frontend dependencies' -ForegroundColor Red"
pause
exit /b 1
)
powershell -Command "Write-Host '[OK] Frontend dependencies installed' -ForegroundColor Green"
) else (
powershell -Command "Write-Host '[OK] Frontend dependencies already installed' -ForegroundColor Green"
)
cd ..
echo.
REM -----------------------------
REM Pull Docker Images
REM -----------------------------
powershell -Command "Write-Host '[STEP] Pulling required Docker images...' -ForegroundColor Yellow"
set IMAGES=python:3.11-slim node:18-slim gcc:11-bullseye eclipse-temurin:17-jdk-alpine mcr.microsoft.com/dotnet/sdk:6.0-alpine rust:1.70-slim golang:1.20-alpine mileschou/lua:5.1-alpine rocker/r-base:latest
for %%i in (%IMAGES%) do (
powershell -Command "Write-Host 'Pulling %%i ...' -ForegroundColor Yellow"
docker pull %%i
if errorlevel 1 powershell -Command "Write-Host '[WARNING] Failed to pull %%i (may already exist)' -ForegroundColor Yellow"
)
powershell -Command "Write-Host '[OK] Docker images ready' -ForegroundColor Green"
echo.
REM -----------------------------
REM Summary
REM -----------------------------
chcp 65001 >nul
powershell -Command "Write-Host '==========================================' -ForegroundColor Cyan"
powershell -Command "Write-Host ' Setup Complete! 🎉' -ForegroundColor Cyan"
powershell -Command "Write-Host '==========================================' -ForegroundColor Cyan"
echo.
echo To start the development servers, run in separate terminals:
echo.
echo Terminal 1 (Backend):
echo cd backend ^&^& npm run dev
echo.
echo Terminal 2 (Frontend):
echo cd frontend ^&^& npm run dev
echo.
echo Then open http://localhost:3000 in your browser
echo.
echo For Docker Compose deployment:
echo docker-compose up --build
echo.
pause
endlocal