dsh-config-sync-plugin 0.4.20 → 0.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +4 -0
- package/README.md +4 -0
- package/package.json +1 -1
- package/runtime/apply.ps1 +5 -1
- package/runtime/install-plugin.ps1 +10 -1
- package/runtime/post-exit.ps1 +10 -1
- package/tools/selftest.mjs +13 -0
package/README.en.md
CHANGED
|
@@ -257,6 +257,10 @@ Two display fixes on top of 0.3.77:
|
|
|
257
257
|
|
|
258
258
|
The "Plugin update" card now shows an **npm download URL** line with the actual fallback addresses (domestic mirror `registry.npmmirror.com` + official `registry.npmjs.org`). When the GitHub release download is unreachable (common in mainland China), the update package automatically falls back to npm. It is still verified against the authoritative sha256 in `version.json` — switching source never relaxes verification. The two sources back each other up: the mirror can briefly 404 during its first-sync window, and the official source takes over. The npm tarball is byte-identical to the GitHub release tgz (same sha256).
|
|
259
259
|
|
|
260
|
+
### 0.4.21 (2026-11-27)
|
|
261
|
+
|
|
262
|
+
- Fix plugin update installation: 0.4.20 switched to pnpm publish, whose repacked tarball has a top-level <name>/ directory instead of npm's standard package/. The installer only accepted package/ and failed with 'unexpected package structure'. The updater now accepts both layouts (post-exit / install-plugin / apply extraction points).
|
|
263
|
+
|
|
260
264
|
### Pull-crash fix: int+string concatenation replaced with -f formatting (0.4.20)
|
|
261
265
|
|
|
262
266
|
This release fixes a crash on the other machine when pulling with 0.4.19, followed by an automatic rollback that left "pull succeeded but workspace/sessions are empty":
|
package/README.md
CHANGED
|
@@ -277,6 +277,10 @@ pwsh -File runtime\sync.ps1 pull `
|
|
|
277
277
|
|
|
278
278
|
「插件更新」卡新增一行 **npm 下载路径**,直接显示实际兜底地址(国内镜像 `registry.npmmirror.com` + 官方 `registry.npmjs.org` 两个源)。GitHub release 整段不通时(国内常见),更新包会自动兜底从 npm 下载;仍按 `version.json` 里的权威 sha256 校验,换源不放宽校验。两个源互为备份:镜像首发同步窗口期会短暂 404,官方源随即兜上。实测 npm tarball 与 GitHub release tgz 是同一份产物、sha256 完全一致。
|
|
279
279
|
|
|
280
|
+
### 0.4.21(2026-11-27)
|
|
281
|
+
|
|
282
|
+
- 修复插件更新安装失败:0.4.20 起改用 pnpm publish 发包,npm 兜底源下到的包顶层是「包名/」目录,旧安装器只认 npm 标准的「package/」,报「安装包结构不对」。更新器现兼容两种结构(post-exit / install-plugin / apply 三处解包点)。
|
|
283
|
+
|
|
280
284
|
### 拉取崩溃修复:int+字符串拼接改 -f 格式化(0.4.20)
|
|
281
285
|
|
|
282
286
|
本版修复 0.4.19 在另一台机器上拉取崩溃、随后自动回滚导致「拉取成功但工作区/会话是空的」的问题:
|
package/package.json
CHANGED
package/runtime/apply.ps1
CHANGED
|
@@ -1470,8 +1470,12 @@ if ($needExtract.Count -gt 0) {
|
|
|
1470
1470
|
New-Item -ItemType Directory -Path $out -Force | Out-Null
|
|
1471
1471
|
& $tarExe -xzf $tgz -C $out
|
|
1472
1472
|
if ($LASTEXITCODE -ne 0) { Die "解压失败:$tgz(tar 退出码 $LASTEXITCODE)" }
|
|
1473
|
-
# npm tgz 的根目录是 package
|
|
1473
|
+
# npm tgz 的根目录是 package/;pnpm publish 重打包的根目录是 包名/ —— 两种都摊平(0.4.21)
|
|
1474
1474
|
$pkgDir = Join-Path $out 'package'
|
|
1475
|
+
if (-not (Test-Path -LiteralPath $pkgDir)) {
|
|
1476
|
+
$altDir = Get-ChildItem -LiteralPath $out -Directory | Where-Object { Test-Path -LiteralPath (Join-Path $_.FullName 'package.json') } | Select-Object -First 1
|
|
1477
|
+
if ($altDir) { $pkgDir = $altDir.FullName }
|
|
1478
|
+
}
|
|
1475
1479
|
if (Test-Path -LiteralPath $pkgDir) {
|
|
1476
1480
|
$final = Join-Path $AppRoot $dirName
|
|
1477
1481
|
if (Test-Path -LiteralPath $final) { Remove-Item -LiteralPath $final -Recurse -Force }
|
|
@@ -130,7 +130,16 @@ try {
|
|
|
130
130
|
& $tar -xzf $pkgPath -C $stage *> $null
|
|
131
131
|
if ($LASTEXITCODE -ne 0) { throw ("解包失败,退出码 {0}" -f $LASTEXITCODE) }
|
|
132
132
|
$payload = Join-Path $stage 'package'
|
|
133
|
-
if (-not (Test-Path -LiteralPath $payload)) {
|
|
133
|
+
if (-not (Test-Path -LiteralPath $payload)) {
|
|
134
|
+
# 0.4.21 兼容 pnpm publish 重打包形态:顶层是 包名/ 目录(如 dsh-config-sync-plugin/)
|
|
135
|
+
$alt = Get-ChildItem -LiteralPath $stage -Directory | Where-Object { Test-Path -LiteralPath (Join-Path $_.FullName 'package.json') } | Select-Object -First 1
|
|
136
|
+
if ($alt) {
|
|
137
|
+
$payload = $alt.FullName
|
|
138
|
+
Log ("包顶层是 {0}/(pnpm 重打包形态),按它安装" -f $alt.Name)
|
|
139
|
+
} else {
|
|
140
|
+
throw '安装包结构不对(里面没有 package 目录)'
|
|
141
|
+
}
|
|
142
|
+
}
|
|
134
143
|
$newVersion = (Get-Content -LiteralPath (Join-Path $payload 'package.json') -Raw -Encoding utf8 | ConvertFrom-Json).version
|
|
135
144
|
Log ("包内版本:{0}" -f $newVersion)
|
|
136
145
|
if ($Version -and $newVersion -ne $Version) { throw ("安装包里的版本是 {0},与清单 {1} 不一致" -f $newVersion, $Version) }
|
package/runtime/post-exit.ps1
CHANGED
|
@@ -615,7 +615,16 @@ if ($Mode -eq 'update') {
|
|
|
615
615
|
& $tar -xzf $tmp -C $stage *>&1 | ForEach-Object { Log ([string]$_) }
|
|
616
616
|
if ($LASTEXITCODE -ne 0) { throw ("解包失败,退出码 {0}" -f $LASTEXITCODE) }
|
|
617
617
|
$payload = Join-Path $stage 'package'
|
|
618
|
-
if (-not (Test-Path -LiteralPath $payload)) {
|
|
618
|
+
if (-not (Test-Path -LiteralPath $payload)) {
|
|
619
|
+
# 0.4.21 兼容 pnpm publish 重打包形态:顶层是 包名/ 目录(如 dsh-config-sync-plugin/)
|
|
620
|
+
$alt = Get-ChildItem -LiteralPath $stage -Directory | Where-Object { Test-Path -LiteralPath (Join-Path $_.FullName 'package.json') } | Select-Object -First 1
|
|
621
|
+
if ($alt) {
|
|
622
|
+
$payload = $alt.FullName
|
|
623
|
+
Log ("包顶层是 {0}/(pnpm 重打包形态),按它安装" -f $alt.Name)
|
|
624
|
+
} else {
|
|
625
|
+
throw '安装包结构不对(里面没有 package 目录)'
|
|
626
|
+
}
|
|
627
|
+
}
|
|
619
628
|
$newVersion = (Get-Content -LiteralPath (Join-Path $payload 'package.json') -Raw -Encoding utf8 | ConvertFrom-Json).version
|
|
620
629
|
if ($UpdateVersion -and $newVersion -ne $UpdateVersion) { throw ("安装包里的版本是 {0},与清单 {1} 不一致" -f $newVersion, $UpdateVersion) }
|
|
621
630
|
} catch { $stageError = $_.Exception.Message }
|
package/tools/selftest.mjs
CHANGED
|
@@ -2148,5 +2148,18 @@ console.log('== 0.4.17:拉取落地加固(前置检查 + 自愈 + 落地验
|
|
|
2148
2148
|
cliS.includes("landing: M('落地检查', 'Landing check')"), 'client.js')
|
|
2149
2149
|
}
|
|
2150
2150
|
|
|
2151
|
+
console.log('== 0.4.21:更新安装兼容 pnpm 重打包结构(顶层 包名/ 而非 package/)==')
|
|
2152
|
+
{
|
|
2153
|
+
const peS = readFileSync(join(pluginRootSelf, 'runtime', 'post-exit.ps1'), 'utf8')
|
|
2154
|
+
const ipS = readFileSync(join(pluginRootSelf, 'runtime', 'install-plugin.ps1'), 'utf8')
|
|
2155
|
+
const apS2 = readFileSync(join(pluginRootSelf, 'runtime', 'apply.ps1'), 'utf8')
|
|
2156
|
+
// 三个解包点都有「package/ 不存在时按 包名/ 兜底」的兼容分支(0.4.21 标志注释)
|
|
2157
|
+
const compat = (s) => s.includes('pnpm 重打包形态') && s.includes("Join-Path $_.FullName 'package.json'")
|
|
2158
|
+
check('post-exit 解包兼容 pnpm 重打包(包名/ 顶层)', compat(peS), 'post-exit.ps1')
|
|
2159
|
+
check('install-plugin 解包兼容 pnpm 重打包(包名/ 顶层)', compat(ipS), 'install-plugin.ps1')
|
|
2160
|
+
check('apply local-plugins 解压兼容 pnpm 重打包(包名/ 顶层)',
|
|
2161
|
+
apS2.includes('pnpm publish 重打包') && apS2.includes("Join-Path $_.FullName 'package.json'"), 'apply.ps1')
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2151
2164
|
process.exit(failures === 0 ? 0 : 1)
|
|
2152
2165
|
|