-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.ps1
More file actions
67 lines (50 loc) · 2.62 KB
/
Copy pathbuild.ps1
File metadata and controls
67 lines (50 loc) · 2.62 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
#!/usr/bin/env pwsh
# GitHub Notes Extension Build Script
# Build script for Chrome/Edge extension store submission
Write-Host "Starting GitHub Notes extension build..." -ForegroundColor Green
# Clean and recreate release directory
Write-Host "Cleaning old release directory..." -ForegroundColor Yellow
Remove-Item -Path release -Recurse -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Path release | Out-Null
# Copy required files
Write-Host "Copying core files..." -ForegroundColor Yellow
Copy-Item -Path manifest.json -Destination release/
Write-Host "Copying source code..." -ForegroundColor Yellow
Copy-Item -Path src -Destination release/ -Recurse
Write-Host "Copying page files..." -ForegroundColor Yellow
Copy-Item -Path pages -Destination release/ -Recurse
Write-Host "Copying style files..." -ForegroundColor Yellow
Copy-Item -Path styles -Destination release/ -Recurse
Write-Host "Copying localization files..." -ForegroundColor Yellow
Copy-Item -Path _locales -Destination release/ -Recurse
# Create assets directory and copy icons
Write-Host "Copying icon assets..." -ForegroundColor Yellow
New-Item -ItemType Directory -Path release/assets | Out-Null
Copy-Item -Path assets/icon*.* -Destination release/assets/
# Get version number
$manifestContent = Get-Content -Path manifest.json -Raw | ConvertFrom-Json
$version = $manifestContent.version
$zipFileName = "github-notes-v$version.zip"
# Count files before packaging
$fileCount = (Get-ChildItem -Path release -Recurse -File).Count
# Create ZIP package
Write-Host "Creating ZIP package: $zipFileName" -ForegroundColor Yellow
Compress-Archive -Path release/* -DestinationPath $zipFileName -Force
# Move ZIP file to release folder
Write-Host "Moving ZIP file to release folder..." -ForegroundColor Yellow
Move-Item -Path $zipFileName -Destination "release/$zipFileName" -Force
# Clean up other files in release folder, keep only ZIP
Write-Host "Cleaning up release folder..." -ForegroundColor Yellow
Get-ChildItem -Path release -Exclude "*.zip" | Remove-Item -Recurse -Force
# Display results
Write-Host "`nExtension build completed!" -ForegroundColor Green
Write-Host "Output file: release/$zipFileName" -ForegroundColor Cyan
Write-Host "Release directory: release/" -ForegroundColor Cyan
# Display file size
$zipSize = (Get-Item "release/$zipFileName").Length
$zipSizeKB = [math]::Round($zipSize / 1KB, 2)
Write-Host "Package size: $zipSizeKB KB" -ForegroundColor Cyan
Write-Host "File count: $fileCount files" -ForegroundColor Cyan
Write-Host "`nYou can now submit release/$zipFileName to Chrome/Edge extension stores!" -ForegroundColor Green
# Optional: open folder
# Invoke-Item .