Files
ssh-manager/scripts/release/build-local-package.bat
2026-04-16 23:28:26 +08:00

65 lines
1.3 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@echo off
setlocal
set "ROOT=%~dp0..\.."
for %%I in ("%ROOT%") do set "ROOT=%%~fI"
set "OUT_DIR=%ROOT%\release\local-package"
cd /d "%ROOT%"
where npm >nul 2>nul
if errorlevel 1 (
echo [ERROR] 未检测到 npm请先安装 Node.js 18+
pause
exit /b 1
)
where mvn >nul 2>nul
if errorlevel 1 (
echo [ERROR] 未检测到 Maven请先安装 Maven 3.6+
pause
exit /b 1
)
if exist "%OUT_DIR%" rmdir /s /q "%OUT_DIR%"
mkdir "%OUT_DIR%"
echo [1/3] 构建前端...
cd /d "%ROOT%\frontend"
call npm run build
if errorlevel 1 (
echo [ERROR] 前端构建失败
pause
exit /b 1
)
echo [2/3] 打包后端...
cd /d "%ROOT%\backend"
call mvn -Pembed-frontend-dist -DskipTests package
if errorlevel 1 (
echo [ERROR] 后端打包失败
pause
exit /b 1
)
echo [3/3] 组装本地版交付包...
copy /Y "%ROOT%\backend\target\*.jar" "%OUT_DIR%\" >nul
copy /Y "%ROOT%\scripts\windows\start-local.bat" "%OUT_DIR%\" >nul
(
echo SSH Manager 本地版
echo.
echo 1. 安装 Java 8+
echo 2. 双击 start-local.bat
echo 3. 浏览器访问 http://localhost:48080
echo.
echo 首次启动会自动在 runtime 目录生成本地密钥,在 data 目录保存数据库数据。
) > "%OUT_DIR%\README.txt"
echo.
echo 本地版交付包已生成:
echo %OUT_DIR%
pause
endlocal