dsh-app-updater 1.3.2 → 1.3.4
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/CHANGELOG.md +293 -191
- package/CONTRACT.md +150 -150
- package/LICENSE +20 -20
- package/README.en.md +243 -239
- package/README.md +275 -253
- package/RELEASING.md +75 -75
- package/cordis.patch.yml +8 -8
- package/icon.svg +32 -32
- package/lib/client.js +1491 -1460
- package/lib/elevate.js +204 -204
- package/lib/engine.js +1315 -1282
- package/lib/index.js +597 -597
- package/lib/macos.js +494 -409
- package/lib/platform.js +199 -199
- package/lib/proc.js +91 -91
- package/lib/registry.js +120 -120
- package/lib/state.js +141 -141
- package/lib/version.js +81 -81
- package/lib/winget.js +337 -337
- package/package.json +68 -68
- package/test/deny.mjs +148 -148
- package/test/harness.mjs +125 -125
- package/test/render.mjs +613 -570
- package/test/unit.mjs +590 -552
package/RELEASING.md
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
# 发版流程
|
|
2
|
-
|
|
3
|
-
这个仓库同时是 **GitHub 插件源码** 和 **npm 包 `dsh-app-updater`**,两者版本必须一致。
|
|
4
|
-
|
|
5
|
-
## 1. 改版本号与更新日志
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# package.json 的 version 改成新版本,例如 1.0.1
|
|
9
|
-
# CHANGELOG.md 顶部加一节(遵循 keep-a-changelog 的写法)
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## 2. 本地自测
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npm test # unit 36 项 + render 32 项
|
|
16
|
-
node test/harness.mjs --scan # 宿主半身跑真实 HTTP(需要 Windows + winget)
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## 3. 发布到 npm
|
|
20
|
-
|
|
21
|
-
npm 目前要求发布必须通过 2FA,或使用**开启 Bypass 2FA 的 Granular Access Token**:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
# 方式 A:账号已开 2FA
|
|
25
|
-
npm publish --access public --otp=<6 位动态码>
|
|
26
|
-
|
|
27
|
-
# 方式 B:用带 Bypass 2FA 的 token(写入临时 userconfig,别写进仓库)
|
|
28
|
-
npm publish --access public --userconfig=<某个仓库外的 .npmrc>
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
> 注意:带 Bypass 2FA 的令牌可以做发布,但**不能**做 `npm unpublish` / 账号类操作,
|
|
32
|
-
> 那些仍然需要在网页上以 2FA 完成。
|
|
33
|
-
|
|
34
|
-
## 4. 打 GitHub Release(附预构建包)
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
npm pack --silent # 产出 dsh-app-updater-<version>.tgz
|
|
38
|
-
mv dsh-app-updater-*.tgz dsh-app-updater.tgz # 资产名不要带版本号
|
|
39
|
-
gh release create v<version> dsh-app-updater.tgz \
|
|
40
|
-
--title "v<version>" --notes-file <(sed -n '/^## \[<version>\]/,/^## \[/p' CHANGELOG.md)
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
资产名必须**不带版本号**:README 与各插件市场用的是
|
|
44
|
-
`releases/latest/download/dsh-app-updater.tgz`,`latest/download/` 只解析 `latest`,
|
|
45
|
-
文件名是按字面取的——一旦资产名带版本号,下一次发版这个链接就会 404。
|
|
46
|
-
如果确实想让文件名带版本号,就把链接改成钉住 tag 的形式(`releases/download/v1.0.0/…`)。
|
|
47
|
-
|
|
48
|
-
## 5. 市场收录怎么更新
|
|
49
|
-
|
|
50
|
-
- **dsh-plugin.org / dshopen.org / awesome-dsh-plugin**:仓库更新后它们按各自刷新周期同步,
|
|
51
|
-
一般不需要重新提交;条目信息(版本、Star、更新时间)会自动跟上。
|
|
52
|
-
- **dsh.works / DSH.SO / DSH STORE**:全部自动抓取,无需任何操作。
|
|
53
|
-
- **DSH Plugin Index(realoiyo.github.io)**:只抓 npm 包,`npm publish` 后下次重建即更新。
|
|
54
|
-
- 提交入口(首次收录用):
|
|
55
|
-
- dsh-plugin.org → https://github.com/dshplugin/dsh-plugin-hub/issues (模板见其 submit 页)
|
|
56
|
-
- dshopen.org → https://github.com/polang233/dsh-plugin-index/issues/new?template=plugin-add.yml
|
|
57
|
-
- awesome-dsh-plugin → 向仓库提 PR,新增 `data/plugins/<owner>__<repo>.yml`(见其 contributing.md)
|
|
58
|
-
|
|
59
|
-
### 刚发版时别人可能装到旧版本
|
|
60
|
-
|
|
61
|
-
pnpm 默认有 `minimumReleaseAge`(新发布的包先观察一段时间才参与解析)。profile 里若没写
|
|
62
|
-
`minimumReleaseAge: 0`,`dsh plugin add <包名>` 在发版后的一段时间内可能仍解析到上一个版本:
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
# 立刻拿到刚发布的版本:显式指定版本号
|
|
66
|
-
dsh plugin --profile web add dsh-app-updater@<version>
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
这不是包的问题,是消费端的供应链策略;等宽限期过去后不带版本号也会解析到新版。
|
|
70
|
-
(排查时看 profile 的 `pnpm-workspace.yaml`:`minimumReleaseAge` 与 `minimumReleaseAgeExclude`。)
|
|
71
|
-
|
|
72
|
-
## 6. 本地开发时的桌面端安装
|
|
73
|
-
|
|
74
|
-
Electron 托管的 `desktop` profile 不接受 `dsh plugin` 写入。做法是在
|
|
75
|
-
`<profile>/node_modules` 下建立指向本仓库的目录 junction,并把包名加进 profile
|
|
1
|
+
# 发版流程
|
|
2
|
+
|
|
3
|
+
这个仓库同时是 **GitHub 插件源码** 和 **npm 包 `dsh-app-updater`**,两者版本必须一致。
|
|
4
|
+
|
|
5
|
+
## 1. 改版本号与更新日志
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# package.json 的 version 改成新版本,例如 1.0.1
|
|
9
|
+
# CHANGELOG.md 顶部加一节(遵循 keep-a-changelog 的写法)
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## 2. 本地自测
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm test # unit 36 项 + render 32 项
|
|
16
|
+
node test/harness.mjs --scan # 宿主半身跑真实 HTTP(需要 Windows + winget)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 3. 发布到 npm
|
|
20
|
+
|
|
21
|
+
npm 目前要求发布必须通过 2FA,或使用**开启 Bypass 2FA 的 Granular Access Token**:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# 方式 A:账号已开 2FA
|
|
25
|
+
npm publish --access public --otp=<6 位动态码>
|
|
26
|
+
|
|
27
|
+
# 方式 B:用带 Bypass 2FA 的 token(写入临时 userconfig,别写进仓库)
|
|
28
|
+
npm publish --access public --userconfig=<某个仓库外的 .npmrc>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
> 注意:带 Bypass 2FA 的令牌可以做发布,但**不能**做 `npm unpublish` / 账号类操作,
|
|
32
|
+
> 那些仍然需要在网页上以 2FA 完成。
|
|
33
|
+
|
|
34
|
+
## 4. 打 GitHub Release(附预构建包)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm pack --silent # 产出 dsh-app-updater-<version>.tgz
|
|
38
|
+
mv dsh-app-updater-*.tgz dsh-app-updater.tgz # 资产名不要带版本号
|
|
39
|
+
gh release create v<version> dsh-app-updater.tgz \
|
|
40
|
+
--title "v<version>" --notes-file <(sed -n '/^## \[<version>\]/,/^## \[/p' CHANGELOG.md)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
资产名必须**不带版本号**:README 与各插件市场用的是
|
|
44
|
+
`releases/latest/download/dsh-app-updater.tgz`,`latest/download/` 只解析 `latest`,
|
|
45
|
+
文件名是按字面取的——一旦资产名带版本号,下一次发版这个链接就会 404。
|
|
46
|
+
如果确实想让文件名带版本号,就把链接改成钉住 tag 的形式(`releases/download/v1.0.0/…`)。
|
|
47
|
+
|
|
48
|
+
## 5. 市场收录怎么更新
|
|
49
|
+
|
|
50
|
+
- **dsh-plugin.org / dshopen.org / awesome-dsh-plugin**:仓库更新后它们按各自刷新周期同步,
|
|
51
|
+
一般不需要重新提交;条目信息(版本、Star、更新时间)会自动跟上。
|
|
52
|
+
- **dsh.works / DSH.SO / DSH STORE**:全部自动抓取,无需任何操作。
|
|
53
|
+
- **DSH Plugin Index(realoiyo.github.io)**:只抓 npm 包,`npm publish` 后下次重建即更新。
|
|
54
|
+
- 提交入口(首次收录用):
|
|
55
|
+
- dsh-plugin.org → https://github.com/dshplugin/dsh-plugin-hub/issues (模板见其 submit 页)
|
|
56
|
+
- dshopen.org → https://github.com/polang233/dsh-plugin-index/issues/new?template=plugin-add.yml
|
|
57
|
+
- awesome-dsh-plugin → 向仓库提 PR,新增 `data/plugins/<owner>__<repo>.yml`(见其 contributing.md)
|
|
58
|
+
|
|
59
|
+
### 刚发版时别人可能装到旧版本
|
|
60
|
+
|
|
61
|
+
pnpm 默认有 `minimumReleaseAge`(新发布的包先观察一段时间才参与解析)。profile 里若没写
|
|
62
|
+
`minimumReleaseAge: 0`,`dsh plugin add <包名>` 在发版后的一段时间内可能仍解析到上一个版本:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# 立刻拿到刚发布的版本:显式指定版本号
|
|
66
|
+
dsh plugin --profile web add dsh-app-updater@<version>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
这不是包的问题,是消费端的供应链策略;等宽限期过去后不带版本号也会解析到新版。
|
|
70
|
+
(排查时看 profile 的 `pnpm-workspace.yaml`:`minimumReleaseAge` 与 `minimumReleaseAgeExclude`。)
|
|
71
|
+
|
|
72
|
+
## 6. 本地开发时的桌面端安装
|
|
73
|
+
|
|
74
|
+
Electron 托管的 `desktop` profile 不接受 `dsh plugin` 写入。做法是在
|
|
75
|
+
`<profile>/node_modules` 下建立指向本仓库的目录 junction,并把包名加进 profile
|
|
76
76
|
`package.json` 的 `dsh.profile.bundles` 与 `dependencies`,重启 DSH 生效。
|
package/cordis.patch.yml
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# dsh-app-updater 的 bundle 补丁层。
|
|
2
|
-
#
|
|
3
|
-
# 一行 insert 挂载宿主半身;浏览器半身由 package.json 的 dsh.client 声明,
|
|
4
|
-
# 并绑定在 name 为裸包名的这一行上。
|
|
5
|
-
- insert:
|
|
6
|
-
- id: dsh-app-updater
|
|
7
|
-
name: 'dsh-app-updater'
|
|
8
|
-
config: {}
|
|
1
|
+
# dsh-app-updater 的 bundle 补丁层。
|
|
2
|
+
#
|
|
3
|
+
# 一行 insert 挂载宿主半身;浏览器半身由 package.json 的 dsh.client 声明,
|
|
4
|
+
# 并绑定在 name 为裸包名的这一行上。
|
|
5
|
+
- insert:
|
|
6
|
+
- id: dsh-app-updater
|
|
7
|
+
name: 'dsh-app-updater'
|
|
8
|
+
config: {}
|
package/icon.svg
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" width="128" height="128" role="img" aria-label="DSH 应用更新">
|
|
2
|
-
<defs>
|
|
3
|
-
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
|
|
4
|
-
<stop offset="0" stop-color="#5b9bff"/>
|
|
5
|
-
<stop offset="1" stop-color="#2f6f4f"/>
|
|
6
|
-
</linearGradient>
|
|
7
|
-
<linearGradient id="win" x1="0" y1="0" x2="0" y2="1">
|
|
8
|
-
<stop offset="0" stop-color="#ffffff"/>
|
|
9
|
-
<stop offset="1" stop-color="#dbe7ff"/>
|
|
10
|
-
</linearGradient>
|
|
11
|
-
</defs>
|
|
12
|
-
|
|
13
|
-
<rect x="4" y="4" width="120" height="120" rx="28" fill="url(#bg)"/>
|
|
14
|
-
|
|
15
|
-
<!-- 应用窗口 -->
|
|
16
|
-
<rect x="26" y="30" width="76" height="58" rx="10" fill="url(#win)"/>
|
|
17
|
-
<rect x="26" y="30" width="76" height="16" rx="10" fill="#1f2937" opacity="0.82"/>
|
|
18
|
-
<circle cx="36" cy="38" r="3.2" fill="#f87171"/>
|
|
19
|
-
<circle cx="46" cy="38" r="3.2" fill="#fbbf24"/>
|
|
20
|
-
<circle cx="56" cy="38" r="3.2" fill="#34d399"/>
|
|
21
|
-
<rect x="36" y="54" width="34" height="5" rx="2.5" fill="#2f4f7a" opacity="0.55"/>
|
|
22
|
-
<rect x="36" y="64" width="48" height="5" rx="2.5" fill="#2f4f7a" opacity="0.3"/>
|
|
23
|
-
<rect x="36" y="74" width="26" height="5" rx="2.5" fill="#2f4f7a" opacity="0.3"/>
|
|
24
|
-
|
|
25
|
-
<!-- 下载箭头 -->
|
|
26
|
-
<path d="M64 60 L64 92" stroke="#ffffff" stroke-width="9" stroke-linecap="round"/>
|
|
27
|
-
<path d="M48 80 L64 96 L80 80" fill="none" stroke="#ffffff" stroke-width="9" stroke-linecap="round" stroke-linejoin="round"/>
|
|
28
|
-
<rect x="42" y="100" width="44" height="8" rx="4" fill="#ffffff" opacity="0.9"/>
|
|
29
|
-
|
|
30
|
-
<!-- 环形更新标记 -->
|
|
31
|
-
<path d="M92 44 A30 30 0 0 1 92 84" fill="none" stroke="#ffffff" stroke-width="7" stroke-linecap="round" opacity="0.85"/>
|
|
32
|
-
<path d="M88 78 L96 86 L88 92" fill="none" stroke="#ffffff" stroke-width="7" stroke-linecap="round" stroke-linejoin="round" opacity="0.85"/>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" width="128" height="128" role="img" aria-label="DSH 应用更新">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
|
|
4
|
+
<stop offset="0" stop-color="#5b9bff"/>
|
|
5
|
+
<stop offset="1" stop-color="#2f6f4f"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
<linearGradient id="win" x1="0" y1="0" x2="0" y2="1">
|
|
8
|
+
<stop offset="0" stop-color="#ffffff"/>
|
|
9
|
+
<stop offset="1" stop-color="#dbe7ff"/>
|
|
10
|
+
</linearGradient>
|
|
11
|
+
</defs>
|
|
12
|
+
|
|
13
|
+
<rect x="4" y="4" width="120" height="120" rx="28" fill="url(#bg)"/>
|
|
14
|
+
|
|
15
|
+
<!-- 应用窗口 -->
|
|
16
|
+
<rect x="26" y="30" width="76" height="58" rx="10" fill="url(#win)"/>
|
|
17
|
+
<rect x="26" y="30" width="76" height="16" rx="10" fill="#1f2937" opacity="0.82"/>
|
|
18
|
+
<circle cx="36" cy="38" r="3.2" fill="#f87171"/>
|
|
19
|
+
<circle cx="46" cy="38" r="3.2" fill="#fbbf24"/>
|
|
20
|
+
<circle cx="56" cy="38" r="3.2" fill="#34d399"/>
|
|
21
|
+
<rect x="36" y="54" width="34" height="5" rx="2.5" fill="#2f4f7a" opacity="0.55"/>
|
|
22
|
+
<rect x="36" y="64" width="48" height="5" rx="2.5" fill="#2f4f7a" opacity="0.3"/>
|
|
23
|
+
<rect x="36" y="74" width="26" height="5" rx="2.5" fill="#2f4f7a" opacity="0.3"/>
|
|
24
|
+
|
|
25
|
+
<!-- 下载箭头 -->
|
|
26
|
+
<path d="M64 60 L64 92" stroke="#ffffff" stroke-width="9" stroke-linecap="round"/>
|
|
27
|
+
<path d="M48 80 L64 96 L80 80" fill="none" stroke="#ffffff" stroke-width="9" stroke-linecap="round" stroke-linejoin="round"/>
|
|
28
|
+
<rect x="42" y="100" width="44" height="8" rx="4" fill="#ffffff" opacity="0.9"/>
|
|
29
|
+
|
|
30
|
+
<!-- 环形更新标记 -->
|
|
31
|
+
<path d="M92 44 A30 30 0 0 1 92 84" fill="none" stroke="#ffffff" stroke-width="7" stroke-linecap="round" opacity="0.85"/>
|
|
32
|
+
<path d="M88 78 L96 86 L88 92" fill="none" stroke="#ffffff" stroke-width="7" stroke-linecap="round" stroke-linejoin="round" opacity="0.85"/>
|
|
33
33
|
</svg>
|