Repository navigation
Expand file tree
/
Copy pathStart_Modex_Demo.bat
More file actions
71 lines (63 loc) · 2.11 KB
/
Copy pathStart_Modex_Demo.bat
File metadata and controls
71 lines (63 loc) · 2.11 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
@echo off
setlocal
title Modex Offline Demo
rem Optional: drag the Modex project folder onto this file.
set "MODEX_DEMO_PROJECT=%~1"
if not defined MODEX_DEMO_PROJECT set "MODEX_DEMO_PROJECT=%~dp0"
if exist "%MODEX_DEMO_PROJECT%\apps\desktop\package.json" goto located
set "MODEX_DEMO_PROJECT=C:\Tools\modex-signing-fix"
if exist "%MODEX_DEMO_PROJECT%\apps\desktop\package.json" goto located
echo Cannot find the Modex project.
echo Put this file beside the project's root package.json,
echo or drag the project folder onto this file.
goto failed
:located
cd /d "%MODEX_DEMO_PROJECT%"
if errorlevel 1 goto failed
echo Project: %CD%
echo This opens the offline demo. It does not commit or push anything.
echo.
where node >nul 2>nul
if errorlevel 1 goto node_missing
where pnpm >nul 2>nul
if errorlevel 1 goto pnpm_missing
node -e "if(Number(process.versions.node.split('.')[0])<22){console.error('Node.js 22 or newer is required.');process.exit(1)}"
if errorlevel 1 goto failed
echo [1/5] Installing or checking dependencies...
call pnpm install --frozen-lockfile
if errorlevel 1 goto failed
echo [2/5] Building the core...
call pnpm --filter @modex/core build
if errorlevel 1 goto failed
echo [3/5] Building the desktop main process...
cd apps\desktop
if errorlevel 1 goto failed
node scripts\prepare-terminal.mjs
if errorlevel 1 goto failed
call pnpm exec tsc -p tsconfig.main.json
if errorlevel 1 goto failed
copy /y src\main\preload.cjs dist\src\main\preload.cjs >nul
if errorlevel 1 goto failed
echo [4/5] Building the interface...
call pnpm run build:renderer
if errorlevel 1 goto failed
echo [5/5] Opening the offline demo...
call pnpm start --demo
if errorlevel 1 goto failed
echo.
echo Demo closed.
pause
exit /b 0
:node_missing
echo Node.js was not found. Install Node.js 22 or newer,
echo then close this window and run this file again.
goto failed
:pnpm_missing
echo pnpm was not found. Run "corepack enable pnpm" in an administrator
echo terminal, then close this window and run this file again.
:failed
echo.
echo The demo could not start or a command failed.
echo Copy or screenshot the error above so we can check it.
pause
exit /b 1