初始化提交
This commit is contained in:
42
build-frontend.bat
Normal file
42
build-frontend.bat
Normal file
@@ -0,0 +1,42 @@
|
||||
@echo off
|
||||
setlocal
|
||||
title Mengya Profile - Build Frontend
|
||||
echo [INFO] Building frontend assets...
|
||||
cd /d "%~dp0mengyaprofile-frontend"
|
||||
|
||||
where npm >nul 2>nul
|
||||
if errorlevel 1 (
|
||||
echo [ERROR] npm not found. Install Node.js and npm.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if not exist "package.json" (
|
||||
echo [ERROR] package.json not found in %CD%
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if not exist "node_modules" goto install_deps
|
||||
goto do_build
|
||||
|
||||
:install_deps
|
||||
echo [INFO] Installing dependencies...
|
||||
npm install --prefix "%~dp0mengyaprofile-frontend"
|
||||
if errorlevel 1 goto deps_fail
|
||||
|
||||
:do_build
|
||||
echo [INFO] Run build: npm run build
|
||||
npm run build --prefix "%~dp0mengyaprofile-frontend"
|
||||
if errorlevel 1 goto build_fail
|
||||
echo [INFO] Build done at %CD%\build
|
||||
goto end
|
||||
|
||||
:deps_fail
|
||||
echo [ERROR] Dependency install failed.
|
||||
goto end
|
||||
|
||||
:build_fail
|
||||
echo [ERROR] Build failed.
|
||||
goto end
|
||||
|
||||
:end
|
||||
endlocal
|
||||
Reference in New Issue
Block a user