xechat-dsh 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/README.md CHANGED
@@ -32,8 +32,8 @@ dsh plugin --profile desktop add xechat-dsh
32
32
  不经过 npm,也可以装仓库里打好的 tarball(`npm pack` 产物,含预构建 `lib/`):
33
33
 
34
34
  ```sh
35
- # 钉版本:dsh plugin --profile desktop add xechat-dsh@0.2.3
36
- dsh plugin --profile web add ./xechat-dsh-0.2.3.tgz
35
+ # 钉版本:dsh plugin --profile desktop add xechat-dsh@0.2.4
36
+ dsh plugin --profile web add ./xechat-dsh-0.2.4.tgz
37
37
  ```
38
38
 
39
39
  仓库根目录另有一键脚本,会校验环境并验证安装结果:
@@ -79,6 +79,90 @@ npm run build # 先构建 Vue 应用,再打包插件 bundle
79
79
  | `lib/client.js` | 插件客户端 bundle(CJS 闭包,`__ModuleLoader__.load` 注册) |
80
80
  | `lib/index.js` | 宿主侧(空实现) |
81
81
 
82
+ ## 发版
83
+
84
+ 五个步骤,顺序不能乱:版本 → 构建 → 推代码 → Release → npm。
85
+
86
+ ### 1. 改版本号
87
+
88
+ ```sh
89
+ npm version patch --no-git-tag-version # 0.2.4 → 0.2.5
90
+ ```
91
+
92
+ npm 上同一个版本号不能复用,重复发布会被直接拒绝。
93
+
94
+ > 本地排障用的构建**不要发 Release、也不要发 npm**,否则用户看到的版本号会莫名其妙跳一档。
95
+
96
+ ### 2. 构建并验证
97
+
98
+ ```sh
99
+ npm run build # 重新生成 lib/
100
+ npm test # 必须 0 失败
101
+ git status --short # 确认 lib/ 的改动也在
102
+ ```
103
+
104
+ `lib/` 是**提交进仓库**的预构建产物,源码安装与 tarball 安装都直接读它。漏提交 `lib/` 会让别人装到旧代码。
105
+
106
+ ### 3. 提交并推送
107
+
108
+ ```sh
109
+ git add -A
110
+ git commit -m "release: <版本号>"
111
+ git push origin main
112
+ ```
113
+
114
+ ### 4. 打 tag + 建 GitHub Release
115
+
116
+ 打开 <https://github.com/chargeduck/xechat-dsh/releases/new>:
117
+
118
+ - **Tag** 填 `v<版本号>`,选 *Create new tag on publish*,target 选 `main`
119
+ - **附件**用 `npm pack` 的产物,但必须改名成不带版本号的 `xechat-dsh.tgz`
120
+
121
+ ```sh
122
+ npm pack # 产出 xechat-dsh-<版本号>.tgz
123
+ cp xechat-dsh-<版本号>.tgz xechat-dsh.tgz # ★ 附件名不能带版本号
124
+ ```
125
+
126
+ > `awesome-dsh-plugin` 条目里写的是 `releases/latest/download/xechat-dsh.tgz`。
127
+ > `latest/download/` 只解析 latest,**文件名照字面取**。附件一旦叫
128
+ > `xechat-dsh-0.2.5.tgz`,下次发版的瞬间链接就 404,而且不会有人察觉。
129
+
130
+ ### 5. 发布到 npm
131
+
132
+ ```sh
133
+ # 先确认登录状态(默认 registry 是 npmmirror,必须显式指定公网)
134
+ npm whoami --registry https://registry.npmjs.org/
135
+
136
+ # 未登录时先登录:会打印一个 URL,在浏览器里过 2FA
137
+ npm login --registry https://registry.npmjs.org/
138
+
139
+ # 发布
140
+ npm publish --registry https://registry.npmjs.org/ --access public
141
+ ```
142
+
143
+ > 不加 `--registry` 会推到内网 npmmirror,或报一个**伪装的**
144
+ > `E404 ... is not in this registry`——那不是包名冲突,是没认证或推错了源。
145
+
146
+ ### 6. 发完验证
147
+
148
+ ```sh
149
+ # npm 的 latest 是否已指向新版本
150
+ curl -s https://registry.npmjs.org/xechat-dsh | grep -o '"latest":"[^"]*"'
151
+
152
+ # Release 附件是否可直接下载(要 200,不能 404)
153
+ curl -sIL https://github.com/chargeduck/xechat-dsh/releases/latest/download/xechat-dsh.tgz \
154
+ | grep -iE "^HTTP/1.1 (200|302)|^content-length"
155
+ ```
156
+
157
+ ### 分发渠道与生效时间
158
+
159
+ | 渠道 | 怎么触发 | 生效 |
160
+ | --- | --- | --- |
161
+ | GitHub Release | 手动打 tag + 传附件 | 立即 |
162
+ | npm | `npm publish` | 几分钟(新账号首发包会先出 `0.0.0-stage` 占位) |
163
+ | dshfind.com | 自动抓 npm,要求 `repository` 指回本仓库 | 次日 |
164
+ | awesome-dsh-plugin 列表 | 条目已合并,`tarball` 走 `latest/download` | 跟随 Release,条目不用改 |
165
+
82
166
  ## 使用
83
167
 
84
168
  登录需要一个可达的 XEChat 服务端: