dsh-english-reader 0.2.3 → 0.2.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/AGENTS.md +1 -0
- package/README.en.md +20 -4
- package/README.md +23 -5
- package/docs/modules/00-loading/README.md +1 -0
- package/docs/modules/00-loading/release.md +53 -0
- package/docs/modules/00-loading/self-update.md +1 -0
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -46,6 +46,7 @@ node --test --test-name-pattern "gloss" test/ # 单用例
|
|
|
46
46
|
| `english_reader` 工具的动作 | [60-tool](./docs/modules/60-tool/README.md) |
|
|
47
47
|
| 写测试、跑测试、为什么有这些用例 | [70-testing](./docs/modules/70-testing/README.md) + `docs/TESTING.zh.md` |
|
|
48
48
|
| 插件自己更新、插件页没有更新按钮 | [00-loading/self-update](./docs/modules/00-loading/self-update.md) |
|
|
49
|
+
| 发新版本、发 npm、版本号怎么定 | [00-loading/release](./docs/modules/00-loading/release.md) |
|
|
49
50
|
| 插件装不上、本地引擎缺失、安装期依赖报错 | [70-testing/install-contract](./docs/modules/70-testing/install-contract.md) + README 的安装与排错段 |
|
|
50
51
|
|
|
51
52
|
## 模块地图
|
package/README.en.md
CHANGED
|
@@ -47,20 +47,26 @@ The settings card has four collapsible sections; only the engine starts open, an
|
|
|
47
47
|
|
|
48
48
|
## Install
|
|
49
49
|
|
|
50
|
-
**From
|
|
50
|
+
**From npm (recommended)**
|
|
51
51
|
|
|
52
|
-
In DSH **Plugins → Add plugin**, enter:
|
|
52
|
+
In DSH **Plugins → Add plugin**, enter the package name:
|
|
53
53
|
|
|
54
54
|
```
|
|
55
|
-
|
|
55
|
+
dsh-english-reader
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
Or on the command line:
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
dsh plugin --profile web add
|
|
61
|
+
dsh plugin --profile web add dsh-english-reader
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
An npm install is the one shape the plugin page can update: it compares registry versions and offers **Update to x.y.z** in place.
|
|
65
|
+
|
|
66
|
+
**From GitHub**
|
|
67
|
+
|
|
68
|
+
Enter `github:KNtnx/dsh-english-reader` (or `dsh plugin --profile web add github:KNtnx/dsh-english-reader`). It follows the latest commit on `main`; the plugin page offers no update button for it (DSH only does that for registry dependencies), but **Check for updates / Update now** in the panel still works.
|
|
69
|
+
|
|
64
70
|
**From a local checkout**
|
|
65
71
|
|
|
66
72
|
```bash
|
|
@@ -161,6 +167,16 @@ A translation is tagged with the source and model that produced it, so switching
|
|
|
161
167
|
- Local models, source records and the dialogue library live under `$DSH_HOME/dsh-english-reader/` and are not uploaded.
|
|
162
168
|
- Translation and speech requests are made from the host, never from the panel.
|
|
163
169
|
|
|
170
|
+
### Updating
|
|
171
|
+
|
|
172
|
+
| How you installed it | How to update |
|
|
173
|
+
| --- | --- |
|
|
174
|
+
| npm | **Update to x.y.z** on the plugin page, or **Check for updates / Update now** in the panel |
|
|
175
|
+
| GitHub | **Check for updates / Update now** in the panel (it reinstalls pinned to a commit), or `dsh plugin --profile web update dsh-english-reader` and restart |
|
|
176
|
+
| Local checkout (`link:`) | `git pull` in that directory, then restart DSH |
|
|
177
|
+
|
|
178
|
+
The version row lives at the bottom of **Settings → Engine**: it shows the installed commit, and **Check for updates** asks the repository for the head of `main` (`git ls-remote`, no token needed). If a release touched `client.js`, refresh the page.
|
|
179
|
+
|
|
164
180
|
### Uninstalling
|
|
165
181
|
|
|
166
182
|
Removing the plugin removes the code only. Your data is still there on reinstall:
|
package/README.md
CHANGED
|
@@ -47,21 +47,27 @@
|
|
|
47
47
|
|
|
48
48
|
## 安装
|
|
49
49
|
|
|
50
|
-
**方式一:从
|
|
50
|
+
**方式一:从 npm 安装(推荐)**
|
|
51
51
|
|
|
52
|
-
在 DSH 的 **插件 → 添加插件**
|
|
52
|
+
在 DSH 的 **插件 → 添加插件** 里填包名:
|
|
53
53
|
|
|
54
54
|
```
|
|
55
|
-
|
|
55
|
+
dsh-english-reader
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
或命令行:
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
dsh plugin --profile web add
|
|
61
|
+
dsh plugin --profile web add dsh-english-reader
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
从 npm 装的好处是**插件详情页自带「更新到 x.y.z」**(DSH 按版本号比较 registry 依赖),点一下就更新,不用重装。
|
|
65
|
+
|
|
66
|
+
**方式二:从 GitHub 安装**
|
|
67
|
+
|
|
68
|
+
填 `github:KNtnx/dsh-english-reader`(或 `dsh plugin --profile web add github:KNtnx/dsh-english-reader`)。跟随 `main` 的最新提交;插件页不会给它更新按钮(DSH 只给 registry 依赖),但面板里的「检查更新 / 立即更新」照样能用。
|
|
69
|
+
|
|
70
|
+
**方式三:本地目录**
|
|
65
71
|
|
|
66
72
|
```bash
|
|
67
73
|
git clone https://github.com/KNtnx/dsh-english-reader.git
|
|
@@ -153,6 +159,18 @@ dsh plugin --profile web add link:./dsh-english-reader
|
|
|
153
159
|
- 本机模型、来源配置与对话库分别在 `$DSH_HOME/dsh-english-reader/models/`、`sources.json` 与 `library.json`,不上传。
|
|
154
160
|
- 翻译与语音请求只从宿主发起,面板不直连第三方。
|
|
155
161
|
|
|
162
|
+
### 更新
|
|
163
|
+
|
|
164
|
+
三种方式,按你装的方式挑一种就行:
|
|
165
|
+
|
|
166
|
+
| 你的安装方式 | 怎么更新 |
|
|
167
|
+
| --- | --- |
|
|
168
|
+
| npm | 插件详情页点「更新到 x.y.z」;或面板设置里的「检查更新 / 立即更新」 |
|
|
169
|
+
| GitHub | 面板设置里的「检查更新」→「立即更新」(它会装成钉住提交的形式);或者 `dsh plugin --profile web update dsh-english-reader` 后重启 |
|
|
170
|
+
| 本地目录(`link:`) | 在那个目录里 `git pull`,然后重启 DSH |
|
|
171
|
+
|
|
172
|
+
面板里的「版本」行在 **设置 → 引擎** 区底部:显示当前提交,点「检查更新」会去问仓库最新的 `main` 提交(用 `git ls-remote`,不需要 token)。装了新版本后如果改到客户端(`client.js`),刷新一下页面。
|
|
173
|
+
|
|
156
174
|
### 卸载
|
|
157
175
|
|
|
158
176
|
删掉插件只删代码。重装以后你的数据还在:
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
| client-registration | `apply(ctx)` 的 5 处注册:tab 类型、面板体、整页、按钮、输入框入口 | [client-registration.md](./client-registration.md) |
|
|
27
27
|
| locale-resources | `locale/*.json` 只管插件详情页,界面文案在 `10-panel/copy` | [locale-resources.md](./locale-resources.md) |
|
|
28
28
|
| self-update | 面板里的「检查更新」:插件页给不了 Git 包的更新按钮,所以按钮长在自己身上 | [self-update.md](./self-update.md) |
|
|
29
|
+
| release | 怎么发货:Git 看提交、npm 看版本号;首发的 tarball 会迟到几分钟 | [release.md](./release.md) |
|
|
29
30
|
|
|
30
31
|
## 数据流
|
|
31
32
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# release
|
|
2
|
+
|
|
3
|
+
## 职责
|
|
4
|
+
|
|
5
|
+
把一次改动变成别人机器上能拿到的版本。两种发货方式并存,规则不同:
|
|
6
|
+
|
|
7
|
+
- **Git**:跟 `main` 的提交走,**不用改版本号**;DSH 插件页不给更新按钮,靠面板里的「检查更新」或命令行的 `dsh plugin update`。
|
|
8
|
+
- **npm**:按 `version` 走,**每次都得 bump 并发布**;这是唯一能在插件详情页出现「更新到 x.y.z」的安装形态。
|
|
9
|
+
|
|
10
|
+
## 位置
|
|
11
|
+
|
|
12
|
+
- `package.json` :: `version`, `publishConfig`, `files`, `dsh`
|
|
13
|
+
- `host/update.js` :: `checkForUpdate`, `applyUpdate`(面板按钮背后的比较与安装)
|
|
14
|
+
- `docs/modules/00-loading/self-update.md`(按钮本身怎么工作)
|
|
15
|
+
- `.github/workflows/`(没有:发布是手动的,见下)
|
|
16
|
+
|
|
17
|
+
## 输入 → 输出
|
|
18
|
+
|
|
19
|
+
| 想做什么 | 命令 | 结果 |
|
|
20
|
+
| --- | --- | --- |
|
|
21
|
+
| 发一个 npm 版本 | `npm version 0.2.4 --no-git-tag-version` → 提交推送 → `npm publish --registry=https://registry.npmjs.org` | 新版本出现在 registry;旧版本用户能在插件页看到更新 |
|
|
22
|
+
| 只发 Git | `git push origin main` | 面板「检查更新」立刻能看到新提交 |
|
|
23
|
+
| 另一台设备更新 | 插件页「更新到 x.y.z」(npm)或面板「立即更新」(两种都行)/ `dsh plugin --profile web update dsh-english-reader`(Git) | 几秒后本机就是新版本 |
|
|
24
|
+
|
|
25
|
+
## 不变量
|
|
26
|
+
|
|
27
|
+
- **npm 装必须 bump**:同一个版本号发不上去(`E403 cannot publish over`),而且插件页按版本号比较,不 bump 等于没更新。`npm version --no-git-tag-version` 只改 `package.json`,标签我们不要。
|
|
28
|
+
- **Git 装不看版本号**:面板比的是提交(`git ls-remote` + 锁文件里的 `tar.gz/<sha>`)。
|
|
29
|
+
- **首次发布有传播延迟**:新包名第一次 publish 后,元数据先出现(`npm view` 有版本),**tarball 仍 404 几分钟**(实测约 6 分钟)。判断"发好了"要用 `npm pack dsh-english-reader@<版本>`,不是 `npm view`。
|
|
30
|
+
- **首次发布会留一个 `0.0.0-stage` 占位版本**:npm 给新包名建的是"暂存占位"(`Temporary package placeholder for staged publishing`),有一段时间 `dist-tags.latest` 指着它。此时在「添加插件」里填包名会报 **`declares no dsh.bundle`**——因为占位包的清单里没有 `dsh` 字段。修法是把标签指回真实版本:`npm dist-tag add dsh-english-reader@0.2.3 latest`,然后用 `npm view <包> version` + `npm pack <包>@<版本>` 双重确认(`npm pack` 能下下来才算真的可用)。
|
|
31
|
+
- **2FA**:`npm login` 拿到的登录 token 不带"免 2FA 证明",直接 publish 会被拦;要么 `--otp=验证器6位`,要么用带 *Bypass 2FA* 的 Granular Access Token 写进 `~/.npmrc`。
|
|
32
|
+
- **别把测试发上去**:`files` 只列运行期文件与文档,`test/` 与 `package-lock.json` 不进包(87 个文件、约 871 KB)。
|
|
33
|
+
- **客户端改动要提示刷新**:只改宿主时插件页/面板热重载即可;改了 `client.js` 得刷新浏览器(bundle 有缓存)。
|
|
34
|
+
- **发布是对外动作**:跑 `npm publish` 之前先用 `--dry-run` 核对文件清单,确认没有本地路径、密钥或测试数据。
|
|
35
|
+
|
|
36
|
+
## 相邻模块
|
|
37
|
+
|
|
38
|
+
- 上游:`00-loading/bundle-manifest`(`files`/`dsh` 字段为什么这么写)、`00-loading/self-update`(面板按钮)。
|
|
39
|
+
- 下游:用户的说明书 `README.md` / `README.en.md` 的「安装」「更新」「卸载」三节(发布方式变了要同步)。
|
|
40
|
+
- 相关:`40-speech/engine-install`(另一个按需下载,它不进 npm 包,是运行时装到 profile 的)。
|
|
41
|
+
|
|
42
|
+
## 改这里时
|
|
43
|
+
|
|
44
|
+
- **改了 `files`**:跑一次 `npm pack --dry-run --json`,确认顶层目录没少(`host/`、`docs/`、`locale/`、`client.js`、`worker.mjs`、`cordis.patch.yml`)。
|
|
45
|
+
- **换了 registry**:`publishConfig.registry` 与本机 `~/.npmrc` 的默认源是两件事;发布命令里显式带 `--registry=https://registry.npmjs.org` 最稳(本机默认源可能指向 npmmirror 镜像,镜像不能发布)。
|
|
46
|
+
- **加自动化**:如果要 CI 发布,用带 bypass 2FA 的 granular token 放进仓库 secret,并保留 `--dry-run` 那一步的检查。
|
|
47
|
+
|
|
48
|
+
## 读代码顺序
|
|
49
|
+
|
|
50
|
+
1. `package.json` 的 `version` / `publishConfig` / `files`。
|
|
51
|
+
2. `host/update.js` 的 `checkForUpdate`:面板怎么判断"有新版本"。
|
|
52
|
+
3. `applyUpdate` 拼的 spec:为什么必须钉到完整提交。
|
|
53
|
+
4. `README` 的三节(安装/更新/卸载)——发布方式一动,它们就得跟着改。
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
- **插件管理器是软依赖**:没有它(或宿主没有 `inject`)时路由照常注册,只有 POST 回 503;检查更新仍然可用。
|
|
28
28
|
- **不用 GitHub API 取提交**:`git ls-remote` 不要 token、不吃速率限制;未认证的 commits 接口用光配额就回 403(实测踩过)。API 只用来补一句提交说明,失败就当没有,不影响判断。
|
|
29
29
|
- **不自动检查**:打开设置不发请求,用户点了才查。
|
|
30
|
+
- **它不是唯一的更新路**:从 npm 装的包,DSH 插件详情页自己就有「更新到 x.y.z」(registry 依赖按版本号比较);面板这个按钮是给 Git 装和「插件页没按钮」的情况用的。两条路都走 `installBundle`,互不冲突。
|
|
30
31
|
- **装上以后要重启吗**:`installBundle` 自己会重载 profile,通常不用;面板提示「重启 DSH 生效」是为了让**新代码**在客户端也干净地加载(客户端 bundle 有缓存)。
|
|
31
32
|
|
|
32
33
|
## 相邻模块
|
package/package.json
CHANGED