Files
Document_Translator/build_frontend.bat
2025-09-02 10:31:35 +08:00

58 lines
1.2 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
echo 正在建構 PANJIT Document Translator 前端...
REM 檢查 Node.js 是否安裝
node --version >nul 2>&1
if errorlevel 1 (
echo 錯誤: 未檢測到 Node.js請先安裝 Node.js 16+ 版本
pause
exit /b 1
)
REM 檢查是否在前端目錄
if not exist "frontend\package.json" (
echo 錯誤: 請在專案根目錄執行此腳本
pause
exit /b 1
)
REM 進入前端目錄
cd frontend
REM 安裝依賴
echo 正在安裝依賴套件...
npm install
if errorlevel 1 (
echo 依賴安裝失敗,請檢查網路連線和 npm 配置
pause
exit /b 1
)
REM 執行 ESLint 檢查
echo 正在執行程式碼檢查...
npm run lint
if errorlevel 1 (
echo 程式碼檢查發現問題,請修復後重試
pause
exit /b 1
)
REM 執行建構
echo 正在建構生產版本...
npm run build
if errorlevel 1 (
echo 建構失敗
pause
exit /b 1
)
echo.
echo ==========================================
echo 建構完成!
echo ==========================================
echo 建構檔案位於: frontend\dist
echo 可使用 nginx 或其他 web 伺服器部署
echo ==========================================
echo.
pause