-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage_tool.ps1
More file actions
52 lines (44 loc) · 1.53 KB
/
Copy pathpackage_tool.ps1
File metadata and controls
52 lines (44 loc) · 1.53 KB
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
param(
[string]$DistDir = ".\dist",
[string]$PackageName = "ai-image-chinese-text-fix-pptx"
)
$ErrorActionPreference = "Stop"
$root = Resolve-Path $PSScriptRoot
$distPath = Resolve-Path -Path (New-Item -ItemType Directory -Force -Path $DistDir)
$packageDir = Join-Path $distPath $PackageName
$zipPath = Join-Path $distPath "$PackageName.zip"
if (Test-Path $packageDir) {
Remove-Item -LiteralPath $packageDir -Recurse -Force
}
if (Test-Path $zipPath) {
Remove-Item -LiteralPath $zipPath -Force
}
New-Item -ItemType Directory -Force -Path $packageDir | Out-Null
New-Item -ItemType Directory -Force -Path (Join-Path $packageDir "tools") | Out-Null
$rootFiles = @(
"ImageRepairTool.ps1",
"RepairImage.cmd",
"convert_images_to_editable_ppt.ps1",
"convert_images_to_svg.ps1",
"SVG_WORKFLOW.md",
"README.md",
"PUBLISHING.md",
"LICENSE",
"requirements.txt",
"package.json",
"package-lock.json"
)
foreach ($file in $rootFiles) {
$source = Join-Path $root $file
if (Test-Path $source) {
Copy-Item -LiteralPath $source -Destination (Join-Path $packageDir $file) -Force
}
}
Get-ChildItem -LiteralPath (Join-Path $root "tools") -File |
Where-Object { $_.Extension -in @(".py", ".mjs") } |
ForEach-Object {
Copy-Item -LiteralPath $_.FullName -Destination (Join-Path $packageDir "tools\$($_.Name)") -Force
}
Compress-Archive -Path (Join-Path $packageDir "*") -DestinationPath $zipPath -Force
Write-Host "Package folder: $packageDir"
Write-Host "Package zip: $zipPath"