-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.bat
More file actions
34 lines (26 loc) · 861 Bytes
/
Copy pathstart.bat
File metadata and controls
34 lines (26 loc) · 861 Bytes
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
@echo off
setlocal
cd /d "%~dp0"
if not exist "package.json" (
echo package.json not found. Please run this file from the bus_test folder.
pause
exit /b 1
)
if not exist "node_modules" (
echo Installing dependencies...
call npm.cmd install
if errorlevel 1 (
echo npm install failed.
pause
exit /b 1
)
)
for /f %%P in ('powershell -NoProfile -ExecutionPolicy Bypass -Command "$port=5173; while ($true) { try { $listener=[Net.Sockets.TcpListener]::new([Net.IPAddress]::Parse('127.0.0.1'), $port); $listener.Start(); $listener.Stop(); Write-Output $port; break } catch { $port++ } }"') do set "PORT=%%P"
set "URL=http://127.0.0.1:%PORT%/"
echo.
echo Starting HK Bus LED OCR Test WebUI...
echo Open: %URL%
echo Press Ctrl+C in this window to stop the server.
echo.
call npm.cmd run dev -- --port %PORT% --strictPort --open /
pause