-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.ps1
More file actions
67 lines (54 loc) · 1.88 KB
/
package.ps1
File metadata and controls
67 lines (54 loc) · 1.88 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Package JSON Viewer Extension for Chrome Web Store
Write-Host "Packaging JSON Viewer Extension..." -ForegroundColor Cyan
# Remove old package if exists
$zipFile = "json-viewer-extension.zip"
if (Test-Path $zipFile) {
Remove-Item $zipFile -Force
Write-Host "Removed existing $zipFile" -ForegroundColor Yellow
}
# Define files and folders to include
$filesToInclude = @(
"manifest.json"
)
$foldersToInclude = @(
"src"
"icons"
)
# Create a temporary directory for packaging
$tempDir = "temp_package"
if (Test-Path $tempDir) {
Remove-Item $tempDir -Recurse -Force
}
New-Item -ItemType Directory -Path $tempDir | Out-Null
# Copy files
foreach ($file in $filesToInclude) {
if (Test-Path $file) {
Copy-Item $file -Destination $tempDir
}
}
# Copy folders (excluding unwanted files)
foreach ($folder in $foldersToInclude) {
if (Test-Path $folder) {
Copy-Item $folder -Destination $tempDir -Recurse
}
}
# Remove unwanted files from temp directory (dev/build files)
Get-ChildItem $tempDir -Recurse -Include "*.DS_Store", ".git*", "*.d.ts", "*.map", "*.ts" | Remove-Item -Force -ErrorAction SilentlyContinue
# Create the zip file
Compress-Archive -Path "$tempDir\*" -DestinationPath $zipFile -Force
# Clean up temp directory
Remove-Item $tempDir -Recurse -Force
Write-Host ""
Write-Host "Package created: $zipFile" -ForegroundColor Green
# Show package contents for verification
Write-Host ""
Write-Host "Package contents:" -ForegroundColor Cyan
Add-Type -AssemblyName System.IO.Compression.FileSystem
$zip = [System.IO.Compression.ZipFile]::OpenRead($zipFile)
$zip.Entries | ForEach-Object { Write-Host " $_" }
$zip.Dispose()
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Cyan
Write-Host "1. Verify the package contents above"
Write-Host "2. Upload to Chrome Web Store Developer Dashboard"
Write-Host " https://chrome.google.com/webstore/devconsole"