64 lines
1.3 KiB
Batchfile
64 lines
1.3 KiB
Batchfile
@echo off
|
|
cd /d "%~dp0"
|
|
|
|
REM Handle commands
|
|
if "%1"=="upgrade" goto upgrade
|
|
if "%1"=="--help" goto help
|
|
if "%1"=="-h" goto help
|
|
if "%1"=="--version" goto version
|
|
if "%1"=="-v" goto version
|
|
|
|
REM Normal launch
|
|
echo Starting Sarthi Lab...
|
|
call npm run dev
|
|
pause
|
|
exit /b 0
|
|
|
|
:upgrade
|
|
echo Upgrading Sarthi Lab...
|
|
|
|
REM Check if git is available
|
|
where git >nul 2>nul
|
|
if errorlevel 1 (
|
|
echo Error: git is not installed. Please install git first.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
REM Pull latest changes
|
|
echo Pulling latest changes from repository...
|
|
git pull
|
|
|
|
REM Install/update dependencies
|
|
echo Installing/updating dependencies...
|
|
call npm install
|
|
|
|
echo Upgrade complete! Starting Sarthi Lab...
|
|
call npm run dev
|
|
pause
|
|
exit /b 0
|
|
|
|
:help
|
|
echo Sarthi Lab Launcher
|
|
echo Usage: sarthi-lab [command]
|
|
echo.
|
|
echo Commands:
|
|
echo (no command) Start Sarthi Lab (npm run dev)
|
|
echo upgrade Pull latest git changes and update dependencies
|
|
echo --help, -h Show this help
|
|
echo --version, -v Show version
|
|
pause
|
|
exit /b 0
|
|
|
|
:version
|
|
REM Try to extract version from package.json using node
|
|
where node >nul 2>nul
|
|
if errorlevel 1 (
|
|
echo Sarthi Lab (version unknown - node not installed)
|
|
) else (
|
|
for /f "delims=" %%i in ('node -p "require('./package.json').version"') do (
|
|
echo Sarthi Lab %%i
|
|
)
|
|
)
|
|
pause
|
|
exit /b 0 |