63 lines
1.4 KiB
Batchfile
63 lines
1.4 KiB
Batchfile
@echo off
|
|
echo ========================================
|
|
echo Starting Production Preview Server
|
|
echo ========================================
|
|
echo.
|
|
|
|
REM Check if pnpm is available
|
|
where pnpm >nul 2>nul
|
|
if errorlevel 1 (
|
|
echo [ERROR] pnpm is not installed or not in PATH.
|
|
echo Please install pnpm: npm install -g pnpm
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
REM Check if node_modules exists
|
|
if not exist "node_modules" (
|
|
echo [INFO] node_modules not found. Installing dependencies...
|
|
echo.
|
|
call pnpm install
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo [ERROR] Failed to install dependencies. Please check your pnpm installation.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo.
|
|
echo [SUCCESS] Dependencies installed successfully.
|
|
echo.
|
|
) else (
|
|
echo [INFO] Dependencies already installed.
|
|
echo.
|
|
)
|
|
|
|
echo [INFO] Building production bundle...
|
|
echo.
|
|
call pnpm build
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo [ERROR] Production build failed.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo [INFO] Starting production preview server...
|
|
echo [INFO] Server will be available at: http://localhost:2333
|
|
echo [INFO] Press Ctrl+C to stop the server
|
|
echo.
|
|
echo ========================================
|
|
echo.
|
|
|
|
REM Start the production server
|
|
set PORT=2333
|
|
call pnpm start
|
|
|
|
REM If server exits, pause to show any errors
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo [ERROR] Production server exited with errors.
|
|
pause
|
|
)
|