File size: 1,335 Bytes
c7d34c1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
$ErrorActionPreference = 'Stop'

$projectRoot = Resolve-Path (Join-Path $PSScriptRoot '..')
$distDir = Join-Path $projectRoot 'dist'
$stageDir = Join-Path $distDir 'gpt-image-playground-customer'
$zipPath = Join-Path $distDir 'gpt-image-playground-customer.zip'

$excludedNames = @(
    '.git',
    '.next',
    'artifacts',
    'node_modules',
    'generated-images',
    'dist'
)

$excludedFiles = @(
    'dev-server.log',
    'dev-server.err.log',
    '.env.local',
    'tsconfig.tsbuildinfo',
    'next-env.d.ts'
)

if (Test-Path $stageDir) {
    Remove-Item -LiteralPath $stageDir -Recurse -Force
}

if (Test-Path $zipPath) {
    Remove-Item -LiteralPath $zipPath -Force
}

New-Item -ItemType Directory -Path $stageDir | Out-Null

Get-ChildItem -LiteralPath $projectRoot -Force | ForEach-Object {
    if ($excludedNames -contains $_.Name) {
        return
    }

    if (-not $_.PSIsContainer -and $excludedFiles -contains $_.Name) {
        return
    }

    Copy-Item -LiteralPath $_.FullName -Destination $stageDir -Recurse -Force
}

Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory($stageDir, $zipPath)

Write-Host ''
Write-Host "Customer package: $zipPath"
Write-Host ''
Write-Host 'Send this zip file to the customer. They can unzip it and run start-windows.bat.'