PozoApp/BUILD-PROJECT.bat

85 lines
2.9 KiB
Batchfile
Raw Normal View History

@echo off
REM ======================================
REM POZO - Build Project with SEO
REM ======================================
echo.
echo ========================================
echo Building POZO Project...
echo ========================================
echo.
REM Stop any running servers first
echo [STEP 1/4] Stopping any running servers...
powershell -Command "Get-Process -Name node -ErrorAction SilentlyContinue | Stop-Process -Force"
echo Done!
echo.
REM Install dependencies if needed
echo [STEP 2/4] Checking dependencies...
if not exist "node_modules" (
echo Installing dependencies...
call npm install
if errorlevel 1 (
echo [ERROR] npm install failed!
pause
exit /b 1
)
) else (
echo Dependencies already installed.
)
echo.
REM Build the project
echo [STEP 3/4] Building project...
echo.
echo This will:
echo - Build React app with Vite
echo - Copy server files to dist
echo - Generate SEO files
echo.
echo Please wait, this may take 1-2 minutes...
echo.
call npm run convert-jsx-to-html
if errorlevel 1 (
echo.
echo ========================================
echo [ERROR] Build failed!
echo ========================================
echo Check the error messages above.
echo Common issues:
echo - Missing dependencies (run: npm install)
echo - Syntax errors in code
echo - Out of memory
echo.
pause
exit /b 1
)
echo.
echo [SUCCESS] Build completed!
echo.
REM Verify build output
echo [STEP 4/4] Verifying build output...
powershell -Command "if (Test-Path 'dist\server.js') { Write-Host ' [OK] dist\server.js' -ForegroundColor Green } else { Write-Host ' [MISSING] dist\server.js' -ForegroundColor Red }"
powershell -Command "if (Test-Path 'dist\server\seo-middleware.js') { Write-Host ' [OK] dist\server\seo-middleware.js' -ForegroundColor Green } else { Write-Host ' [MISSING] dist\server\seo-middleware.js' -ForegroundColor Red }"
powershell -Command "if (Test-Path 'dist\web.config') { Write-Host ' [OK] dist\web.config' -ForegroundColor Green } else { Write-Host ' [MISSING] dist\web.config' -ForegroundColor Red }"
powershell -Command "if (Test-Path 'dist\home\pricing-pozoapp\index.html') { Write-Host ' [OK] dist\home\pricing-pozoapp\index.html' -ForegroundColor Green } else { Write-Host ' [MISSING] dist\home\pricing-pozoapp\index.html' -ForegroundColor Red }"
powershell -Command "if (Test-Path 'dist\home\blog\index.html') { Write-Host ' [OK] dist\home\blog\index.html' -ForegroundColor Green } else { Write-Host ' [MISSING] dist\home\blog\index.html' -ForegroundColor Red }"
echo.
echo ========================================
echo Build Complete!
echo ========================================
echo.
echo Next steps:
echo 1. Double-click START-SERVER.bat to test locally
echo 2. Open http://localhost:3000/home/ in browser
echo 3. Verify SEO tags with Ctrl+U (View Source)
echo 4. If all looks good, deploy dist folder to server
echo.
pause