Files
syncdb/build-and-run.cmd
T
曾志威 5e5f2aa7fe feat: enhance sync workflows and add WES configuration exports
Add the React console, strengthen synchronization and retry handling, and export WES MySQL and MongoDB configuration packages.
2026-10-14 11:39:04 +08:00

51 lines
1.1 KiB
Batchfile

@echo off
setlocal
title syncdb - Build and Run
pushd "%~dp0"
if errorlevel 1 goto directory_failed
where go.exe >nul 2>&1
if errorlevel 1 goto go_missing
set "GOOS=windows"
set "GOARCH="
set "CGO_ENABLED=0"
echo [1/2] Building dist\syncdb.exe ...
go.exe build -trimpath -ldflags="-s -w" -o dist/syncdb.exe ./cmd/syncdb
if errorlevel 1 goto build_failed
echo [2/2] Starting syncdb. Press Ctrl+C to stop.
echo The default browser opens automatically unless SYNCDB_OPEN_BROWSER=false.
"%~dp0dist\syncdb.exe" %*
set "result=%errorlevel%"
if not "%result%"=="0" (
echo.
echo Startup or execution failed. Check the error above and whether the port is already in use.
pause
)
popd
exit /b %result%
:go_missing
echo ERROR: Go 1.26 or later is required. Install Go and add it to PATH.
goto failed
:build_failed
echo.
echo ERROR: Build failed. The application was not started.
echo If syncdb.exe is already running, stop it before rebuilding.
goto failed
:failed
pause
popd
exit /b 1
:directory_failed
echo ERROR: Cannot open the project directory.
pause
exit /b 1