Skip to content

Commit b81c40f

Browse files
committed
chore: bump version to 0.0.3 and update publishing instructions in README files
1 parent f498914 commit b81c40f

5 files changed

Lines changed: 47 additions & 19 deletions

File tree

.github/workflows/CI.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,19 +264,21 @@ jobs:
264264
- name: List packages
265265
run: ls -R ./npm
266266
shell: bash
267-
- name: Publish
267+
- name: Publish platform packages and main package
268268
run: |
269-
npm config set provenance true
270-
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
271-
then
269+
COMMIT_MSG=$(git log -1 --pretty=%B)
270+
if echo "$COMMIT_MSG" | grep -qE "^[0-9]+\.[0-9]+\.[0-9]+$"; then
271+
npm config set provenance true
272272
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
273+
pnpm prepublishOnly
273274
npm publish --access public
274-
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
275-
then
275+
elif echo "$COMMIT_MSG" | grep -qE "[0-9]+\.[0-9]+\.[0-9]+"; then
276+
npm config set provenance true
276277
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
278+
pnpm prepublishOnly
277279
npm publish --tag next --access public
278280
else
279-
echo "Not a release, skipping publish"
281+
echo "Not a release (commit message is not a version), skipping publish"
280282
fi
281283
env:
282284
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
authors = []
44
edition = "2021"
55
name = "rush_fs"
6-
version = "0.0.2"
6+
version = "0.0.3"
77

88
[lib]
99
crate-type = ["cdylib"]

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,11 +530,11 @@ See [CONTRIBUTING.md](./CONTRIBUTING.md) for the complete development guide —
530530
}
531531
```
532532

533-
Then publish both the platform-specific packages and the main package:
533+
Then publish both the platform-specific packages and the main package **in order**:
534534

535535
1. Ensure you are logged in to npm (`npm login`).
536-
2. Bump the version via `pnpm version <patch|minor|major>` (this runs `pnpm preversion` to build the release binaries).
537-
3. Publish every optional dependency in `package.json` by running `pnpm prepublishOnly` (which executes `napi prepublish -t npm` and pushes `rush-fs-<platform>` packages such as `rush-fs-darwin-arm64`).
536+
2. Bump the version via `pnpm version <patch|minor|major>`. This runs `pnpm preversion`, which builds the `.node` artifacts under `npm/` for each platform. **These files must exist before the next step can publish them.**
537+
3. Run `pnpm prepublishOnly` (which runs `napi prepublish -t npm`) to publish each built package from `npm/` (e.g. `rush-fs-darwin-arm64`, `rush-fs-win32-x64-msvc`). **If you see "doesn't exist" here, you skipped the build—run `pnpm build` or complete step 2 first.**
538538
4. Publish the main package with `pnpm publish --access public`. The `prepublishOnly` hook runs automatically, but running step 3 manually lets you verify each platform succeeded before tagging the main release.
539539

540540
If any platform publish fails, fix it and re-run `pnpm prepublishOnly` before retrying `pnpm publish` so consumers never receive a release referring to missing optional dependencies.

README.zh-CN.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -420,14 +420,34 @@ Rush-FS 在文件系统遍历类操作中使用多线程并行:
420420

421421
## 发布(维护者专用)
422422

423-
`rush-fs` 会为每个平台发布一个预编译二进制(参见 `package.json` 中的 `optionalDependencies`)。要发布新版本,请依次执行:
423+
`rush-fs` 会为每个平台发布一个预编译二进制(参见 `package.json` 中的 `optionalDependencies`)。**若只有 Mac,无法本地构建 Windows/Linux 的 .node,请用下面的「通过 CI 发布」。**
424424

425-
1. 确保已执行 `npm login`
426-
2. 使用 `pnpm version <patch|minor|major>` 提升版本号(内部会运行 `pnpm preversion`,构建 release 产物)。
427-
3. 运行 `pnpm prepublishOnly`(即 `napi prepublish -t npm`)逐个发布 `rush-fs-<platform>` 可选依赖,例如 `rush-fs-darwin-arm64``rush-fs-win32-x64-msvc` 等。
428-
4. 最后执行 `pnpm publish --access public` 发布主包。`prepublishOnly` 会自动触发,但提前单独跑第 3 步可以先确认各平台包已成功发布。
425+
### 通过 GitHub Actions 发布(推荐)
426+
427+
CI 已在多平台(macOS x64/arm64、Windows、Linux)构建并测试,通过后可由同一 workflow 发布到 npm。
428+
429+
1. 在仓库 **Settings → Secrets and variables → Actions** 里添加 **NPM_TOKEN**(npm 账号生成的 Classic Token,需允许发布)。
430+
2. 确保 `package.json``Cargo.toml` 中版本号一致(如 `0.0.3`),且 `package.json` 里已包含四个 `optionalDependencies`(版本与主包一致)。
431+
3. 提交并推送到 `main`**且该次提交的 commit message 仅为版本号**(如 `0.0.3`)。CI 跑通后会自动:先发布四个平台包,再发布主包 `rush-fs`
429432

430-
一旦某个平台包发布失败,修复问题后需重新执行 `pnpm prepublishOnly`,确保主包不会依赖缺失的可选依赖。
433+
示例:
434+
435+
```bash
436+
# 版本和 optionalDependencies 已改好后
437+
git add package.json Cargo.toml
438+
git commit -m "0.0.3"
439+
git push origin main
440+
```
441+
442+
4. 发版完成后,若希望 CI 继续用 `pnpm install --frozen-lockfile`,可在仓库里删掉 `optionalDependencies` 再提交,下次发版前再加回。
443+
444+
### 本地发布(需能构建各平台)
445+
446+
若本机可构建所有平台(或只发当前平台),可按顺序执行:
447+
448+
1. 确保已执行 `npm login`
449+
2. 使用 `pnpm version <patch|minor|major>` 提升版本号(会执行 `pnpm preversion``npm/` 下构建)。
450+
3. 运行 `pnpm prepublishOnly` 发布各平台包,再执行 `pnpm publish --access public` 发布主包。
431451

432452
## 许可证
433453

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rush-fs",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "High-performance drop-in replacement for Node.js fs module, powered by Rust",
55
"main": "index.js",
66
"repository": {
@@ -113,5 +113,11 @@
113113
"singleQuote": true,
114114
"arrowParens": "always"
115115
},
116-
"packageManager": "pnpm@9.15.4"
116+
"packageManager": "pnpm@9.15.4",
117+
"optionalDependencies": {
118+
"rush-fs-win32-x64-msvc": "0.0.3",
119+
"rush-fs-darwin-x64": "0.0.3",
120+
"rush-fs-linux-x64-gnu": "0.0.3",
121+
"rush-fs-darwin-arm64": "0.0.3"
122+
}
117123
}

0 commit comments

Comments
 (0)