Skip to content

Commit 3838b59

Browse files
committed
chore: update SDK DLLs and add pack script
1 parent 31305cc commit 3838b59

3 files changed

Lines changed: 68 additions & 0 deletions

File tree

lib/InkCanvas.Controls.dll

0 Bytes
Binary file not shown.

lib/InkCanvas.PluginSdk.dll

0 Bytes
Binary file not shown.

pack.ps1

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# 打包示例插件为 .icpx 文件
2+
$ErrorActionPreference = "Stop"
3+
4+
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
5+
$outputDir = Join-Path $scriptDir "bin\Debug\net6.0-windows10.0.19041.0"
6+
$packagesDir = Join-Path $scriptDir "packages"
7+
8+
# 读取 manifest 获取插件 ID 和版本
9+
$manifest = Get-Content (Join-Path $outputDir "manifest.json") | ConvertFrom-Json
10+
$pluginId = $manifest.Id
11+
$version = $manifest.Version
12+
13+
Write-Host "正在打包插件: $pluginId v$version" -ForegroundColor Cyan
14+
15+
# 创建 packages 目录
16+
if (-not (Test-Path $packagesDir)) {
17+
New-Item -ItemType Directory -Path $packagesDir | Out-Null
18+
}
19+
20+
# 收集需要打包的文件
21+
$files = @(
22+
"manifest.json",
23+
"SamplePlugin.dll",
24+
"SamplePlugin.deps.json"
25+
)
26+
27+
# 创建临时目录
28+
$tempDir = Join-Path $env:TEMP "icpx_package_$pluginId"
29+
if (Test-Path $tempDir) { Remove-Item $tempDir -Recurse -Force }
30+
New-Item -ItemType Directory -Path $tempDir | Out-Null
31+
32+
# 复制文件到临时目录
33+
foreach ($f in $files) {
34+
$src = Join-Path $outputDir $f
35+
if (Test-Path $src) {
36+
Copy-Item $src $tempDir
37+
Write-Host " + $f"
38+
} else {
39+
Write-Host " ! $f (未找到,跳过)" -ForegroundColor Yellow
40+
}
41+
}
42+
43+
# 打包为 .icpx (ZIP)
44+
$icpxName = "$pluginId.icpx"
45+
$zipPath = Join-Path $packagesDir ($pluginId + ".zip")
46+
$icpxPath = Join-Path $packagesDir $icpxName
47+
48+
if (Test-Path $zipPath) { Remove-Item $zipPath }
49+
Compress-Archive -Path (Join-Path $tempDir '*') -DestinationPath $zipPath -Force
50+
51+
if (Test-Path $icpxPath) { Remove-Item $icpxPath }
52+
Rename-Item $zipPath $icpxName
53+
54+
# 计算 SHA256
55+
$hash = (Get-FileHash $icpxPath -Algorithm SHA256).Hash.ToLower()
56+
Write-Host ""
57+
Write-Host "打包完成: $icpxPath" -ForegroundColor Green
58+
Write-Host "文件大小: $((Get-Item $icpxPath).Length) bytes"
59+
Write-Host "SHA256: $hash"
60+
Write-Host ""
61+
Write-Host "下一步:" -ForegroundColor Yellow
62+
Write-Host " 1. 在 GitHub 上为 SamplePlugin 创建 Release v$version"
63+
Write-Host " 2. 将 $icpxName 上传为 Release Asset"
64+
Write-Host " 3. 更新 PluginIndex/index.json 中的 DownloadUrl 和 DownloadSha256"
65+
Write-Host " 4. 推送 PluginIndex 仓库"
66+
67+
# 清理
68+
Remove-Item $tempDir -Recurse -Force

0 commit comments

Comments
 (0)