@guojinpeng/dsh-cost-meter 0.1.2 → 0.1.3

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
@@ -22,11 +22,11 @@ Replace `web` with your profile name.
22
22
  If you used the old unscoped package, disable it before you install this package.
23
23
 
24
24
  If the npm package is not available, download the scoped package from
25
- [GitHub Releases](https://github.com/guojinpeng/dsh-cost-meter/releases).
25
+ [the latest GitHub Release](https://github.com/guojinpeng/dsh-cost-meter/releases/latest/download/guojinpeng-dsh-cost-meter.tgz).
26
26
  Run this command in the download directory:
27
27
 
28
28
  ```powershell
29
- dsh plugin --profile web add -w ./guojinpeng-dsh-cost-meter-0.1.2.tgz
29
+ dsh plugin --profile web add -w ./guojinpeng-dsh-cost-meter.tgz
30
30
  ```
31
31
 
32
32
  Restart DSH.
@@ -84,10 +84,10 @@ npm pack
84
84
  ```
85
85
 
86
86
  `npm pack` also runs the build. It creates `guojinpeng-dsh-cost-meter-<version>.tgz`.
87
- Install the generated file in your DSH profile. For version 0.1.2:
87
+ Install the generated file in your DSH profile. For version 0.1.3:
88
88
 
89
89
  ```powershell
90
- dsh plugin --profile web add -w ./guojinpeng-dsh-cost-meter-0.1.2.tgz
90
+ dsh plugin --profile web add -w ./guojinpeng-dsh-cost-meter-0.1.3.tgz
91
91
  ```
92
92
 
93
93
  Restart DSH and check the plugin. Repeat the build, package and install steps after changes.
@@ -113,19 +113,30 @@ Update `package.json`. You can use this command to increase the patch version wi
113
113
  npm version patch --no-git-tag-version
114
114
  pnpm install --lockfile-only
115
115
  npm test
116
- npm pack --dry-run
116
+ npm run pack:release
117
117
  ```
118
118
 
119
- Check the file list from `npm pack --dry-run`. Then publish the public package:
119
+ Check the package file list. `pack:release` creates the versioned npm tarball and
120
+ an identical copy named `guojinpeng-dsh-cost-meter.tgz` for GitHub Releases.
121
+ Commit and push the version change. Then publish the versioned tarball. For 0.1.3:
120
122
 
121
123
  ```powershell
122
- npm publish --access public --registry=https://registry.npmjs.org/
124
+ npm publish ./guojinpeng-dsh-cost-meter-0.1.3.tgz --access public --registry=https://registry.npmjs.org/
123
125
  npm view @guojinpeng/dsh-cost-meter version --registry=https://registry.npmjs.org/
124
126
  ```
125
127
 
126
128
  Complete npm's authentication steps when prompted.
127
129
  Each package version can be published only once.
128
- Commit and push the version change. Create the matching Git tag and GitHub Release.
130
+ After npm publication succeeds, create the matching Git tag and GitHub Release:
131
+
132
+ ```powershell
133
+ git tag v0.1.3
134
+ git push origin v0.1.3
135
+ gh release create v0.1.3 ./guojinpeng-dsh-cost-meter.tgz --verify-tag --title "v0.1.3" --generate-notes --latest
136
+ ```
137
+
138
+ Use the new version number for each release. Always upload the fixed-name asset
139
+ to the latest release. Keep that asset name unchanged so the latest download URL works.
129
140
 
130
141
  Users can then install the package:
131
142
 
package/README.zh-CN.md CHANGED
@@ -22,11 +22,11 @@ dsh plugin --profile web add -w @guojinpeng/dsh-cost-meter
22
22
  如果已安装旧版无 scope 的插件,请先禁用旧版,再安装此插件。
23
23
 
24
24
  如果 npm 包尚不可用,请从
25
- [GitHub Releases](https://github.com/guojinpeng/dsh-cost-meter/releases)
25
+ [GitHub 最新版安装包](https://github.com/guojinpeng/dsh-cost-meter/releases/latest/download/guojinpeng-dsh-cost-meter.tgz)
26
26
  下载 scoped 安装包。在下载目录执行:
27
27
 
28
28
  ```powershell
29
- dsh plugin --profile web add -w ./guojinpeng-dsh-cost-meter-0.1.2.tgz
29
+ dsh plugin --profile web add -w ./guojinpeng-dsh-cost-meter.tgz
30
30
  ```
31
31
 
32
32
  安装后重启 DSH。
@@ -84,10 +84,10 @@ npm pack
84
84
  ```
85
85
 
86
86
  `npm pack` 也会执行构建,生成 `guojinpeng-dsh-cost-meter-<版本号>.tgz`。
87
- 将生成的文件安装到你的 DSH profile。以 0.1.2 为例:
87
+ 将生成的文件安装到你的 DSH profile。以 0.1.3 为例:
88
88
 
89
89
  ```powershell
90
- dsh plugin --profile web add -w ./guojinpeng-dsh-cost-meter-0.1.2.tgz
90
+ dsh plugin --profile web add -w ./guojinpeng-dsh-cost-meter-0.1.3.tgz
91
91
  ```
92
92
 
93
93
  重启 DSH,检查插件。每次修改后,重新构建、打包并安装。
@@ -113,19 +113,30 @@ npm view @guojinpeng/dsh-cost-meter version --registry=https://registry.npmjs.or
113
113
  npm version patch --no-git-tag-version
114
114
  pnpm install --lockfile-only
115
115
  npm test
116
- npm pack --dry-run
116
+ npm run pack:release
117
117
  ```
118
118
 
119
- 检查 `npm pack --dry-run` 列出的文件。然后发布公开包:
119
+ 检查安装包的文件列表。`pack:release` 生成带版本号的 npm 安装包,
120
+ 并复制一份内容相同的 `guojinpeng-dsh-cost-meter.tgz`,用于 GitHub Release。
121
+ 提交并推送版本变更,然后发布带版本号的安装包。以 0.1.3 为例:
120
122
 
121
123
  ```powershell
122
- npm publish --access public --registry=https://registry.npmjs.org/
124
+ npm publish ./guojinpeng-dsh-cost-meter-0.1.3.tgz --access public --registry=https://registry.npmjs.org/
123
125
  npm view @guojinpeng/dsh-cost-meter version --registry=https://registry.npmjs.org/
124
126
  ```
125
127
 
126
128
  根据提示完成 npm 身份验证。
127
129
  同一包版本只能发布一次。
128
- 提交并推送版本变更,创建对应的 Git 标签和 GitHub Release。
130
+ npm 发布成功后,创建对应的 Git 标签和 GitHub Release:
131
+
132
+ ```powershell
133
+ git tag v0.1.3
134
+ git push origin v0.1.3
135
+ gh release create v0.1.3 ./guojinpeng-dsh-cost-meter.tgz --verify-tag --title "v0.1.3" --generate-notes --latest
136
+ ```
137
+
138
+ 每次发布都使用新的版本号,并将固定名称的安装包上传到最新 Release。
139
+ 保持附件名称不变,最新版下载链接才能持续可用。
129
140
 
130
141
  发布后,用户可执行以下命令安装:
131
142
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guojinpeng/dsh-cost-meter",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "DSH 会话和每轮费用估算插件,支持 models.dev 价格同步与自定义模型单价。配置位于 ~/.dsh/guojinpeng/dsh-cost-meter/config.json。",
6
6
  "license": "MIT",
@@ -35,6 +35,7 @@
35
35
  "scripts": {
36
36
  "build": "tsup src/index.js src/client.js --format esm --out-dir dist --clean --no-splitting",
37
37
  "prepack": "npm run build",
38
+ "pack:release": "node scripts/pack-release.js",
38
39
  "test": "node --test tests/*.test.js"
39
40
  },
40
41
  "dsh": {