Skip to content

Commit 6ca9ea5

Browse files
committed
docs: add publishing instructions for maintainers in README files
1 parent 7ee466b commit 6ca9ea5

File tree

2 files changed

+31
-11
lines changed

2 files changed

+31
-11
lines changed

README.md

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,28 +74,28 @@ graph TD
7474

7575
## How does it works
7676

77-
For the original Node.js, it works serially and cost lots of memory to parse os object and string into JS style:
77+
For the original Node.js, it works serially and cost lots of memory to parse os object and string into JS style:
7878

7979
```mermaid
8080
graph TD
8181
A["JS: readdir"] -->|Call| B("Node.js C++ Binding")
8282
B -->|Submit Task| C{"Libuv Thread Pool"}
83-
83+
8484
subgraph "Native Layer (Serial)"
8585
C -->|"Syscall: getdents"| D[OS Kernel]
8686
D -->|"Return File List"| C
8787
C -->|"Process Paths"| C
8888
end
89-
89+
9090
C -->|"Results Ready"| E("V8 Main Thread")
91-
91+
9292
subgraph "V8 Interaction (Heavy)"
9393
E -->|"Create JS String 1"| F[V8 Heap]
9494
E -->|"String 2"| F
9595
E -->|"String N..."| F
9696
F -->|"GC Pressure Rising"| F
9797
end
98-
98+
9999
E -->|"Return Array"| G["JS Callback/Promise"]
100100
```
101101

@@ -105,25 +105,23 @@ But, it's saved with Rust now:
105105
graph TD
106106
A["JS: readdir"] -->|"N-API Call"| B("Rust Wrapper")
107107
B -->|"Spawn Thread/Task"| C{"Rust Thread Pool"}
108-
108+
109109
subgraph "Rust 'Black Box'"
110110
C -->|"Rayon: Parallel work"| D[OS Kernel]
111111
D -->|"Syscall: getdents"| C
112112
C -->|"Store as Rust Vec<String>"| H[Rust Heap]
113113
H -->|"No V8 Interaction yet"| H
114114
end
115-
115+
116116
C -->|"All Done"| I("Convert to JS")
117-
117+
118118
subgraph "N-API Bridge"
119119
I -->|"Batch Create JS Array"| J[V8 Heap]
120120
end
121-
121+
122122
J -->|Return| K["JS Result"]
123123
```
124124

125-
126-
127125
## Status & Roadmap
128126

129127
We are rewriting `fs` APIs one by one.
@@ -519,6 +517,17 @@ Optimal concurrency for `cp` is **4 threads** on Apple Silicon — beyond that,
519517

520518
See [CONTRIBUTING.md](./CONTRIBUTING.md) for the complete development guide — from environment setup, referencing Node.js source, writing Rust implementations, to testing and benchmarking.
521519

520+
## Publishing (Maintainers Only)
521+
522+
`rush-fs` ships prebuilt native binaries per platform (see `optionalDependencies` in `package.json`). When cutting a release you must publish both the platform-specific packages and the main package:
523+
524+
1. Ensure you are logged in to npm (`npm login`).
525+
2. Bump the version via `pnpm version <patch|minor|major>` (this runs `pnpm preversion` to build the release binaries).
526+
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`).
527+
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.
528+
529+
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.
530+
522531
## License
523532

524533
MIT

README.zh-CN.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,17 @@ Rush-FS 在文件系统遍历类操作中使用多线程并行:
418418

419419
参阅 [CONTRIBUTING.md](./CONTRIBUTING.md) — 完整的开发指南,涵盖环境搭建、参考 Node.js 源码、编写 Rust 实现、测试与性能基准。
420420

421+
## 发布(维护者专用)
422+
423+
`rush-fs` 会为每个平台发布一个预编译二进制(参见 `package.json` 中的 `optionalDependencies`)。要发布新版本,请依次执行:
424+
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 步可以先确认各平台包已成功发布。
429+
430+
一旦某个平台包发布失败,修复问题后需重新执行 `pnpm prepublishOnly`,确保主包不会依赖缺失的可选依赖。
431+
421432
## 许可证
422433

423434
MIT

0 commit comments

Comments
 (0)