-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.ps1
36 lines (28 loc) · 1.29 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Arrêter le script si une erreur survient
$ErrorActionPreference = "Stop"
Write-Host "=== Starting build process ===" -ForegroundColor Cyan
# Build Next.js app
Write-Host "Building Next.js app..." -ForegroundColor Green
Set-Location -Path frontend
npm install
npm run build
Write-Host "=== Preparing static files ===" -ForegroundColor Cyan
# Clean and create static directory
if (Test-Path -Path "../backend/static") {
Write-Host "Removing old static directory..." -ForegroundColor Yellow
Remove-Item -Recurse -Force ../backend/static
}
Write-Host "Creating new static directory..." -ForegroundColor Green
New-Item -ItemType Directory -Force -Path ../backend/static | Out-Null
# Copy the exported Next.js app to Flask static directory
Write-Host "Copying files to static directory..." -ForegroundColor Green
Copy-Item -Recurse -Force out/* ../backend/static/
# Verify the copy
Write-Host "=== Verifying static files ===" -ForegroundColor Cyan
if (-not (Test-Path -Path "../backend/static/index.html")) {
Write-Host "ERROR: index.html not found in static directory!" -ForegroundColor Red
exit 1
}
Write-Host "Contents of static directory:" -ForegroundColor Green
Get-ChildItem -Path ../backend/static | Format-Table Name, Length, LastWriteTime
Write-Host "=== Build complete ===" -ForegroundColor Cyan