-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-packages.bat
More file actions
85 lines (71 loc) · 2.15 KB
/
Copy pathbuild-packages.bat
File metadata and controls
85 lines (71 loc) · 2.15 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
@echo off
setlocal enabledelayedexpansion
:: ==============================================================================
:: build-packages.bat
:: Creates packaged desktop builds of ProCase for macOS and Windows.
::
:: Usage:
:: build-packages.bat (Build for both macOS and Windows)
:: build-packages.bat mac (Build for macOS only)
:: build-packages.bat win (Build for Windows only)
:: ==============================================================================
cd /d "%~dp0"
set "TARGET=%~1"
if "%TARGET%"=="" set "TARGET=all"
echo =================================================
echo ProCase Desktop Build ^& Package Generator
echo =================================================
echo Target: %TARGET%
echo.
:: 1. Ensure dependencies are installed
if not exist "node_modules" (
echo ==^> node_modules not found. Running npm install...
call npm install
if errorlevel 1 goto :error
)
:: 2. Build TypeScript and Vite web & electron bundles
echo ==^> Step 1: Compiling TypeScript and building Vite bundle...
call npm run build
if errorlevel 1 goto :error
:: 3. Package based on target
if /i "%TARGET%"=="mac" goto :build_mac
if /i "%TARGET%"=="win" goto :build_win
if /i "%TARGET%"=="all" goto :build_all
echo Unknown target: %TARGET%
echo Valid options: all, mac, win
exit /b 1
:build_mac
echo.
echo ==^> Step 2: Packaging for macOS...
call npx electron-builder --mac
if errorlevel 1 goto :error
goto :done
:build_win
echo.
echo ==^> Step 2: Packaging for Windows...
call npx electron-builder --win
if errorlevel 1 goto :error
goto :done
:build_all
echo.
echo ==^> Step 2: Packaging for macOS...
call npx electron-builder --mac
if errorlevel 1 goto :error
echo.
echo ==^> Step 3: Packaging for Windows...
call npx electron-builder --win
if errorlevel 1 goto :error
goto :done
:done
echo.
echo =================================================
echo Build successful! Artifacts generated in: release\
echo =================================================
dir release
exit /b 0
:error
echo.
echo =================================================
echo [ERROR] Packaging failed!
echo =================================================
exit /b 1