Repository navigation
Expand file tree
/
Copy pathBUILD.bat
More file actions
76 lines (65 loc) · 1.95 KB
/
Copy pathBUILD.bat
File metadata and controls
76 lines (65 loc) · 1.95 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
@echo off
title nullmesh Builder
pushd "%~dp0"
if not exist "package.json" (
echo ERROR: Run this from the nullmesh folder. Current: %CD%
pause & popd & exit /b 1
)
echo.
echo ===================================
echo nullmesh - Building installer
echo ===================================
echo Folder: %CD%
echo.
where node >nul 2>&1
if errorlevel 1 ( echo ERROR: Node.js not installed & pause & popd & exit /b 1 )
for /f %%v in ('node --version') do echo Node: %%v
where pnpm >nul 2>&1
if errorlevel 1 (
echo pnpm not found - installing it globally via npm...
call npm install -g pnpm
if errorlevel 1 ( echo ERROR: could not install pnpm & pause & popd & exit /b 1 )
)
for /f %%v in ('pnpm --version') do echo pnpm: %%v
REM Clean everything
echo Cleaning...
if exist "dist" rmdir /s /q dist
if exist "server.bundle.cjs" del /q server.bundle.cjs
if exist "%LOCALAPPDATA%\electron-builder\Cache\winCodeSign" (
rmdir /s /q "%LOCALAPPDATA%\electron-builder\Cache\winCodeSign"
)
REM Verify main.js exists
if not exist "main.js" (
echo ERROR: main.js not found in %CD%
pause & popd & exit /b 1
)
echo main.js found OK
REM Install
echo Installing dependencies...
call pnpm install --frozen-lockfile
if errorlevel 1 ( echo pnpm install failed & pause & popd & exit /b 1 )
REM Bundle
echo.
echo Bundling server code...
call node bundle.mjs
if errorlevel 1 ( echo Bundle failed & pause & popd & exit /b 1 )
if not exist "server.bundle.cjs" (
echo ERROR: server.bundle.cjs was not created
pause & popd & exit /b 1
)
echo server.bundle.cjs created OK
REM Build
echo.
echo Building installer...
set CSC_IDENTITY_AUTO_DISCOVERY=false
set WIN_CSC_LINK=
set CSC_LINK=
call node_modules\.bin\electron-builder.cmd --win --x64
if errorlevel 1 ( echo Build failed - scroll up for the error & pause & popd & exit /b 1 )
echo.
echo ===================================
echo Done! Installer is in dist\
echo ===================================
explorer "%~dp0dist"
pause
popd