Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Operators double-click LAUNCH for git pull, npm build, data prep, cloudflared, and AetherForge or dev miner-server; devrun shares launch-prep.
75 lines
1.8 KiB
Batchfile
75 lines
1.8 KiB
Batchfile
@echo off
|
|
setlocal EnableExtensions
|
|
set "PREP_ROOT=%~1"
|
|
if "%PREP_ROOT%"=="" (
|
|
echo [Prep] ERROR: launch-prep.bat requires repo root path.
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo Pulling latest from origin/main...
|
|
if exist "%PREP_ROOT%\.git" (
|
|
pushd "%PREP_ROOT%" >nul
|
|
git pull origin main
|
|
if errorlevel 1 (
|
|
echo [Prep] Note: git pull skipped or failed ^(offline, no remote, or local changes^).
|
|
) else (
|
|
echo [Prep] Git pull finished.
|
|
)
|
|
popd >nul
|
|
) else (
|
|
echo [Prep] Skipped ^(not a git checkout^).
|
|
)
|
|
|
|
if not exist "%PREP_ROOT%\server\web\package.json" (
|
|
echo [Prep] No server\web\package.json - skipping UI build.
|
|
exit /b 0
|
|
)
|
|
|
|
set "PATH=C:\Program Files\nodejs;%PATH%"
|
|
where npm >nul 2>nul
|
|
if errorlevel 1 (
|
|
echo [Prep] WARNING: npm not found - skipping UI build.
|
|
exit /b 0
|
|
)
|
|
|
|
echo.
|
|
echo Building UI ^(server\web^)...
|
|
cd /d "%PREP_ROOT%\server\web"
|
|
if not exist "node_modules" (
|
|
if exist "package-lock.json" (
|
|
echo [Prep] npm ci...
|
|
call npm ci
|
|
) else (
|
|
echo [Prep] npm install...
|
|
call npm install
|
|
)
|
|
if errorlevel 1 (
|
|
cd /d "%PREP_ROOT%"
|
|
echo [Prep] ERROR: npm install failed.
|
|
exit /b 1
|
|
)
|
|
)
|
|
|
|
echo [Prep] npm run build ^(this may take a few minutes^)...
|
|
call npm run build
|
|
if errorlevel 1 (
|
|
cd /d "%PREP_ROOT%"
|
|
echo [Prep] ERROR: Frontend build failed.
|
|
exit /b 1
|
|
)
|
|
cd /d "%PREP_ROOT%"
|
|
|
|
if not exist "%PREP_ROOT%\server\webroot" mkdir "%PREP_ROOT%\server\webroot"
|
|
echo [Prep] Syncing server\webroot...
|
|
xcopy /E /I /Y /Q "server\web\dist\*" "server\webroot\" >nul
|
|
|
|
if exist "%PREP_ROOT%\usb" (
|
|
if not exist "%PREP_ROOT%\usb\webroot" mkdir "%PREP_ROOT%\usb\webroot"
|
|
echo [Prep] Syncing usb\webroot...
|
|
xcopy /E /I /Y /Q "server\web\dist\*" "usb\webroot\" >nul
|
|
)
|
|
|
|
echo [Prep] UI build complete.
|
|
exit /b 0
|