-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
87 lines (75 loc) · 2.93 KB
/
Copy pathbuild.ps1
File metadata and controls
87 lines (75 loc) · 2.93 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Build Script for cleanMyCache Extension
# Creates a production-ready package with only bundled locales (en, id)
# Remote locales (ar, bn, de, es, fr, hi, ja, pt_BR, ru, zh_CN) are loaded from GitHub
param(
[string]$OutputDir = "dist",
[string]$Version = "1.0.4"
)
Write-Host "Building cleanMyCache Extension v$Version" -ForegroundColor Cyan
Write-Host ""
# Create output directory
$distPath = Join-Path $PSScriptRoot $OutputDir
if (Test-Path $distPath) {
Write-Host "Cleaning existing dist directory..." -ForegroundColor Yellow
Remove-Item $distPath -Recurse -Force
}
New-Item -ItemType Directory -Path $distPath | Out-Null
Write-Host "Created dist directory: $distPath" -ForegroundColor Green
Write-Host ""
# Files and directories to include
$includes = @(
"manifest.json",
"background.js",
"content",
"popup",
"options",
"images",
"_locales/en",
"_locales/id"
)
# Copy files
Write-Host "Copying extension files..." -ForegroundColor Cyan
foreach ($item in $includes) {
$sourcePath = Join-Path $PSScriptRoot $item
$destPath = Join-Path $distPath $item
if (Test-Path $sourcePath) {
if (Test-Path $sourcePath -PathType Container) {
# Directory
Copy-Item $sourcePath -Destination $destPath -Recurse -Force
Write-Host " Copied directory: $item" -ForegroundColor Gray
}
else {
# File
$destDir = Split-Path $destPath -Parent
if (-not (Test-Path $destDir)) {
New-Item -ItemType Directory -Path $destDir -Force | Out-Null
}
Copy-Item $sourcePath -Destination $destPath -Force
Write-Host " Copied file: $item" -ForegroundColor Gray
}
}
else {
Write-Host " Not found: $item" -ForegroundColor Yellow
}
}
Write-Host ""
Write-Host "Package Statistics:" -ForegroundColor Cyan
# Calculate sizes
$totalSize = (Get-ChildItem $distPath -Recurse | Measure-Object -Property Length -Sum).Sum
$totalSizeMB = [math]::Round($totalSize / 1MB, 2)
$totalSizeKB = [math]::Round($totalSize / 1KB, 0)
Write-Host " Total Size: $totalSizeKB KB" -ForegroundColor White
# Count locales
$localeCount = (Get-ChildItem (Join-Path $distPath "_locales") -Directory).Count
Write-Host " Bundled Locales: $localeCount (en, id)" -ForegroundColor White
Write-Host " Remote Locales: 10 (loaded from GitHub)" -ForegroundColor White
Write-Host ""
Write-Host "Build complete!" -ForegroundColor Green
Write-Host "Package location: $distPath" -ForegroundColor Cyan
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Yellow
Write-Host " 1. Test the extension from the dist folder" -ForegroundColor White
Write-Host " 2. Create ZIP for Chrome Web Store:" -ForegroundColor White
Write-Host " Compress-Archive -Path '$distPath\*' -DestinationPath 'cleanMyCache-v$Version.zip'" -ForegroundColor Gray
Write-Host " 3. Submit to Chrome Web Store" -ForegroundColor White
Write-Host ""