-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-windows.bat
More file actions
161 lines (133 loc) · 4.01 KB
/
build-windows.bat
File metadata and controls
161 lines (133 loc) · 4.01 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
@echo off
REM S3 Migration Scheduler - Windows Desktop Build Script
REM This script builds Windows desktop packages (.exe installer and .zip portable)
setlocal enabledelayedexpansion
REM Configuration
set VERSION=1.1.0
echo.
echo =========================================================================
echo S3 Migration Scheduler - Windows Build
echo Version %VERSION%
echo =========================================================================
echo.
REM Get script directory and project root
set SCRIPT_DIR=%~dp0
set PROJECT_ROOT=%SCRIPT_DIR%..\..\..
echo Project root: %PROJECT_ROOT%
echo.
REM Step 1: Verify prerequisites
echo Step 1: Checking Prerequisites...
echo ======================================
REM Check Node.js
echo Checking Node.js...
node --version >nul 2>&1
if !errorlevel! neq 0 (
echo ERROR: Node.js is not installed or not in PATH
pause
exit /b 1
)
echo + Node.js found
REM Check npm
echo Checking npm...
where npm >nul 2>&1
if !errorlevel! neq 0 (
echo ERROR: npm is not installed or not in PATH
pause
exit /b 1
)
echo + npm found
echo.
echo Continuing to Step 2...
REM Step 2: Build React client (if not already built)
echo Step 2: Ensuring React Client is Built...
echo ===========================================
cd /d "%PROJECT_ROOT%\client"
if not exist "build\index.html" (
echo React client not found, building...
echo Installing client dependencies...
call npm install
if errorlevel 1 (
echo ERROR: Failed to install client dependencies
pause
exit /b 1
)
echo + Client dependencies installed successfully
echo Building React client...
call npm run build
if errorlevel 1 (
echo ERROR: Failed to build React client
pause
exit /b 1
)
echo + React client built successfully
) else (
echo + React client already built
)
echo.
REM Step 3: Build Windows desktop packages
echo Step 3: Building Windows Desktop Packages...
echo =============================================
cd /d "%PROJECT_ROOT%\electron-app"
REM Install electron dependencies if needed
if not exist "node_modules" (
echo Installing electron app dependencies...
call npm install
if errorlevel 1 (
echo ERROR: Failed to install electron app dependencies
pause
exit /b 1
)
echo + Electron app dependencies installed successfully
)
REM Ensure server dependencies are installed
echo Installing server dependencies...
cd /d "%PROJECT_ROOT%\server"
call npm install --production
if errorlevel 1 (
echo ERROR: Failed to install server dependencies
pause
exit /b 1
)
echo + Server dependencies installed
cd /d "%PROJECT_ROOT%\electron-app"
echo Building Windows packages...
call npm run build:win
if errorlevel 1 (
echo ERROR: Failed to build Windows packages
pause
exit /b 1
)
echo + Windows packages built successfully
echo.
REM Step 4: List built assets
echo Step 4: Build Results...
echo ========================
echo.
echo BUILD COMPLETED SUCCESSFULLY!
echo.
if exist "dist" (
echo Windows Desktop Packages:
echo -------------------------
dir /b "dist\*.exe" 2>nul | findstr /r ".*" >nul && (
for %%f in (dist\*.exe) do echo + %%~nxf ^(installer^)
)
dir /b "dist\*.zip" 2>nul | findstr /r ".*" >nul && (
for %%f in (dist\*.zip) do echo + %%~nxf ^(portable^)
)
echo.
echo Built files location: %PROJECT_ROOT%\electron-app\dist%
echo.
choice /c YN /m "Open dist directory in Explorer? "
if !errorlevel! equ 1 (
start explorer "dist"
)
) else (
echo ERROR: No dist directory found
)
echo.
echo =========================================================================
echo WINDOWS BUILD SCRIPT COMPLETED
echo Version %VERSION%
echo =========================================================================
echo.
pause