# Simple PowerShell script to create Laravel deployment ZIP
$zipName = "catalogue-builder-deployment.zip"
$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
$zipName = "catalogue-builder-deployment-$timestamp.zip"

Write-Host "Creating deployment package: $zipName" -ForegroundColor Green

# Remove old ZIP
if (Test-Path $zipName) { Remove-Item $zipName }

# Create temp directory
$tempDir = "temp-deploy"
if (Test-Path $tempDir) { Remove-Item -Recurse -Force $tempDir }
New-Item -ItemType Directory -Path $tempDir | Out-Null

Write-Host "Copying files..." -ForegroundColor Yellow

# Copy files, excluding unwanted ones
robocopy . $tempDir /E /XD .git vendor node_modules storage\logs storage\framework\cache\data storage\framework\sessions storage\framework\views storage\framework\testing bootstrap\cache tests .vscode .idea /XF .env ngrok.exe database.sqlite .phpunit.result.cache dev-server.php *.log .DS_Store Thumbs.db /NFL /NDL /NJH /NJS

# Create necessary empty directories
$keepDirs = @("storage\logs", "storage\framework\cache\data", "storage\framework\sessions", "storage\framework\views", "storage\framework\testing", "bootstrap\cache")
foreach ($dir in $keepDirs) {
    $path = Join-Path $tempDir $dir
    if (-not (Test-Path $path)) {
        New-Item -ItemType Directory -Path $path -Force | Out-Null
        New-Item -ItemType File -Path (Join-Path $path ".gitkeep") -Force | Out-Null
    }
}

Write-Host "Creating ZIP..." -ForegroundColor Yellow
Compress-Archive -Path "$tempDir\*" -DestinationPath $zipName -Force

Write-Host "Cleaning up..." -ForegroundColor Yellow
Remove-Item -Recurse -Force $tempDir

Write-Host ""
Write-Host "✅ Created: $zipName" -ForegroundColor Green














