You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
2.4 KiB
88 lines
2.4 KiB
@echo off
|
|
REM ===============================================
|
|
REM Task Track - Development Mode with Hot Reload
|
|
REM ===============================================
|
|
|
|
setlocal enabledelayedexpansion
|
|
|
|
echo [INFO] Starting Task Track Development Environment...
|
|
echo.
|
|
|
|
REM Check if Air is installed
|
|
set "AIR_PATH=%USERPROFILE%\go\bin\air.exe"
|
|
if not exist "%AIR_PATH%" (
|
|
echo [ERROR] Air not installed. Please install Air first:
|
|
echo go install github.com/air-verse/air@latest
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo [INFO] Air is installed. Starting hot reload mode...
|
|
|
|
REM Create tmp directory
|
|
if not exist "backend\tmp" (
|
|
mkdir "backend\tmp"
|
|
echo [INFO] Created tmp directory
|
|
)
|
|
|
|
REM Clean up existing backend processes
|
|
echo [INFO] Checking and cleaning existing backend processes...
|
|
tasklist /fi "imagename eq task-track-backend.exe" /fo csv | findstr /i "task-track-backend.exe" >nul
|
|
if %errorlevel% equ 0 (
|
|
echo [INFO] Found running backend process, terminating...
|
|
taskkill /f /im task-track-backend.exe >nul 2>&1
|
|
timeout /t 2 /nobreak >nul
|
|
)
|
|
|
|
REM Check port usage
|
|
echo [INFO] Checking port 8080 usage...
|
|
for /f "tokens=5" %%a in ('netstat -ano ^| findstr ":8080"') do (
|
|
set "pid=%%a"
|
|
if defined pid (
|
|
echo [WARNING] Port 8080 is occupied by process !pid!, terminating...
|
|
taskkill /f /pid !pid! >nul 2>&1
|
|
timeout /t 2 /nobreak >nul
|
|
)
|
|
)
|
|
|
|
REM Install frontend dependencies if needed
|
|
if not exist "frontend\node_modules" (
|
|
echo [INFO] Installing frontend dependencies...
|
|
cd frontend
|
|
npm install
|
|
cd ..
|
|
echo [INFO] Frontend dependencies installed
|
|
)
|
|
|
|
REM Start frontend dev server
|
|
echo [INFO] Starting frontend dev server...
|
|
start "Frontend Dev Server" /d "frontend" cmd /c "npm run dev"
|
|
echo [INFO] Waiting for frontend server to start...
|
|
timeout /t 5 /nobreak >nul
|
|
|
|
echo.
|
|
echo ================================
|
|
echo Development Environment Started!
|
|
echo ================================
|
|
echo.
|
|
echo 📱 Frontend: http://localhost:5173
|
|
echo 🔗 Backend: http://localhost:8080 (Hot Reload)
|
|
echo.
|
|
echo 🔥 Hot Reload Features:
|
|
echo - Backend: Code changes auto-restart server
|
|
echo - Frontend: Code changes auto-refresh browser
|
|
echo.
|
|
echo [INFO] Press Ctrl+C to stop the dev server
|
|
echo.
|
|
|
|
cd backend
|
|
"%AIR_PATH%"
|
|
|
|
echo.
|
|
echo [INFO] Backend dev server stopped
|
|
echo [INFO] Stopping frontend dev server...
|
|
taskkill /f /im node.exe >nul 2>&1
|
|
echo [INFO] All dev servers stopped
|
|
cd ..
|
|
|
|
pause
|
|
|