-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpack-for-store.ps1
More file actions
55 lines (46 loc) · 2.03 KB
/
pack-for-store.ps1
File metadata and controls
55 lines (46 loc) · 2.03 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
# Chrome Web Store 打包脚本 (Windows PowerShell)
$manifestContent = Get-Content "manifest.json" -Raw
$versionMatch = $manifestContent -match '"version":\s*"([^"]+)"'
if ($versionMatch) {
$VERSION = $matches[1]
} else {
Write-Host "❌ 无法读取版本号" -ForegroundColor Red
exit 1
}
$OUTPUT_FILE = "starseeker-v${VERSION}.zip"
Write-Host "📦 开始打包 Star Seeker v${VERSION}..." -ForegroundColor Cyan
# 创建临时目录
$TEMP_DIR = New-TemporaryFile | ForEach-Object { Remove-Item $_; New-Item -ItemType Directory -Path $_ }
Write-Host "📁 临时目录: $TEMP_DIR" -ForegroundColor Gray
# 复制必需文件
Write-Host "📋 复制文件..." -ForegroundColor Cyan
Copy-Item -Path "background" -Destination "$TEMP_DIR\background" -Recurse -Force
Copy-Item -Path "content" -Destination "$TEMP_DIR\content" -Recurse -Force
Copy-Item -Path "popup" -Destination "$TEMP_DIR\popup" -Recurse -Force
Copy-Item -Path "icons" -Destination "$TEMP_DIR\icons" -Recurse -Force
Copy-Item -Path "manifest.json" -Destination "$TEMP_DIR\manifest.json" -Force
# 清理不需要的文件
Write-Host "🧹 清理临时文件..." -ForegroundColor Cyan
Get-ChildItem -Path $TEMP_DIR -Recurse -File | Where-Object {
$_.Extension -eq ".md" -or
$_.Extension -eq ".sh" -or
$_.Extension -eq ".py" -or
$_.Name -eq ".DS_Store"
} | Remove-Item -Force
# 创建 ZIP 文件
Write-Host "📦 创建 ZIP 文件..." -ForegroundColor Cyan
$zipPath = Join-Path (Get-Location) $OUTPUT_FILE
if (Test-Path $zipPath) {
Remove-Item $zipPath -Force
}
Compress-Archive -Path "$TEMP_DIR\*" -DestinationPath $zipPath -Force
# 清理临时目录
Remove-Item $TEMP_DIR -Recurse -Force
Write-Host "✅ 打包完成!" -ForegroundColor Green
Write-Host "📦 文件位置: $zipPath" -ForegroundColor Cyan
Write-Host ""
Write-Host "📝 下一步:" -ForegroundColor Yellow
Write-Host "1. 访问 https://chrome.google.com/webstore/devconsole"
Write-Host "2. 上传 $OUTPUT_FILE"
Write-Host "3. 填写商店信息(参考 PUBLISH_GUIDE.md)"
Write-Host "4. 提交审核"