-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.bat
More file actions
131 lines (108 loc) · 2.72 KB
/
dev.bat
File metadata and controls
131 lines (108 loc) · 2.72 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
@echo off
setlocal enabledelayedexpansion
title SpeedForge Development Launcher
cls
REM Set UTF-8 code page for better console output
chcp 65001 > nul
REM Store PIDs for cleanup
set "RUST_PID="
set "UI_PID="
echo ========================================
echo SpeedForge Development Environment
echo ========================================
echo.
:MENU
echo Choose an option:
echo 1. Start both backend and UI
echo 2. Start Rust backend only
echo 3. Start UI only
echo 4. Build and package application
echo 5. Exit
echo.
set /p CHOICE=Enter your choice (1-5):
if "%CHOICE%"=="1" goto START_BOTH
if "%CHOICE%"=="2" goto START_BACKEND
if "%CHOICE%"=="3" goto START_UI
if "%CHOICE%"=="4" goto BUILD_APP
if "%CHOICE%"=="5" goto EXIT
echo Invalid choice. Please try again.
echo.
goto MENU
:START_BOTH
echo.
echo Starting Rust Telemetry Backend...
echo.
REM Start the Rust telemetry backend in a separate window
start "SpeedForge Telemetry" cmd /c "cd rust_app && run.bat && pause"
REM Wait a moment to ensure backend has time to start up
timeout /t 3 /nobreak > nul
echo Starting React UI Application...
echo.
REM Start the React UI application
start "SpeedForge UI" cmd /c "npm run electron:dev"
echo Both applications started!
echo.
echo ========================================
echo - Telemetry backend runs on port 8080
echo - To stop all applications, close their windows
echo ========================================
echo.
goto EXIT
:START_BACKEND
echo.
echo Starting Rust Telemetry Backend...
echo.
REM Start the Rust telemetry backend
cd rust_app
call run.bat
cd ..
goto EXIT
:START_UI
echo.
echo Starting React UI Application...
echo.
REM Check if the backend is already running by testing port 8080
netstat -an | find "8080" | find "LISTENING" > nul
if errorlevel 1 (
echo Warning: Telemetry backend doesn't seem to be running on port 8080.
echo Widgets requiring telemetry data may not function correctly.
echo.
set /p CONTINUE=Continue anyway? (Y/N):
if /i "!CONTINUE!"=="N" goto MENU
)
REM Start the React UI application
npm run electron:dev
goto EXIT
:BUILD_APP
echo.
echo Building and packaging SpeedForge application...
echo.
REM First build the Rust backend
echo Building Rust backend...
cd rust_app
cargo build --release
if errorlevel 1 (
echo Rust backend build failed. Aborting packaging.
cd ..
pause
goto MENU
)
cd ..
REM Then build the UI application
echo Building UI application...
call npm run build
echo.
if errorlevel 1 (
echo Build failed. See errors above.
) else (
echo Build completed successfully!
echo Distribution files are in the dist folder.
)
pause
goto MENU
:EXIT
echo.
echo Thank you for using SpeedForge Development Environment
echo.
timeout /t 2 /nobreak > nul
exit /b 0