-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.bat
More file actions
45 lines (38 loc) · 1.74 KB
/
start.bat
File metadata and controls
45 lines (38 loc) · 1.74 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
@echo off
setlocal
:: ── Check Node.js ─────────────────────────────────────────────────────────
where node >nul 2>&1
if errorlevel 1 (
echo ERROR: Node.js not found. Install it from https://nodejs.org then try again.
pause
exit /b 1
)
:: ── Install deps (first run only) ─────────────────────────────────────────
if not exist node_modules (
echo Installing dependencies...
call npm install
if errorlevel 1 goto :fail
)
:: ── Build web-dm ──────────────────────────────────────────────────────────
echo Building...
call npm run build
if errorlevel 1 goto :fail
:: ── Launch server in its own titled window ────────────────────────────────
echo Starting Beholden...
start "Beholden" cmd /k "npm start"
:: Give the server a moment to bind its port
:wait
timeout /t 1 /nobreak >nul
powershell -NoProfile -Command "try{$t=New-Object Net.Sockets.TcpClient;$t.Connect('127.0.0.1',5174);$t.Close();exit 0}catch{exit 1}" >nul 2>&1
if errorlevel 1 goto :wait
:: ── Open browser ──────────────────────────────────────────────────────────
start "" "http://localhost:5174"
echo.
echo Beholden is running at http://localhost:5174
echo The server window can be closed to stop it.
exit /b 0
:fail
echo.
echo Failed. See error above.
pause
exit /b 1