@pawover/kit 0.7.0 → 0.8.1-alpha.5

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
@@ -106,6 +106,82 @@ pnpm install
106
106
  | `pnpm build` | turbo 构建全部子包(tsdown 生成 ESM/CJS 双格式与类型声明) |
107
107
  | `pnpm check` | 并行运行 types / eslint / format 检查 |
108
108
 
109
+ ## 发布
110
+
111
+ 发布由 [Changesets](https://changesets.dev) v3 + GitHub Actions 全自动驱动,push `main` 即触发,全程无需手动登录 npm 或输入 OTP(走 Trusted Publishing / OIDC 认证,发布自动附带 provenance 证明)。
112
+
113
+ ### 一图流
114
+
115
+ ```
116
+ push main
117
+ └─ select-mode(读 .changeset/ + 对比 git tag)
118
+ ├─ 有 changeset 文件 ───────→ version 通道:自动建/更「Version Packages」PR
119
+ │ └─ 合并 PR → push main → 再次 select-mode
120
+ ├─ 无 changeset,但版本 > git tag ─→ publish 通道:build → pack → 发布 → 打 git tag
121
+ └─ 无变化 ──────────────────→ unchanged:安全空跑
122
+ ```
123
+
124
+ ### 日常发布循环
125
+
126
+ 1. **改代码**——不要手动修改任何 `package.json` 的 `version` 字段,版本号只能由 changesets 生成
127
+ 2. **写 changeset**:`pnpm changeset`(交互式勾选受影响包与 bump 级别),生成 `.changeset/*.md` 变更说明;也可手写该文件,示例:
128
+
129
+ ```md
130
+ ---
131
+ "@pawover/kit-utils": patch
132
+ "@pawover/kit-hooks": minor
133
+ ---
134
+
135
+ 修复 xxx 问题 / 新增 xxx 能力
136
+ ```
137
+
138
+ 3. **提交 PR**:changeset 文件**必须与代码同 PR**,合并到 `main`
139
+ 4. **CI 自动创建 / 更新「Version Packages」PR**:消费 changeset → 计算各包新版本号 → 更新 CHANGELOG(合并前 CI 会先跑 `scripts/verify-release.mjs` 守卫)
140
+ 5. **审核并合并 Version Packages PR**:确认版本号符合预期、`@pawover/kit` 根包在发布列表中(有子包变更时必在)
141
+ 6. **CI 自动发布**:`select-mode` 进入 publish 通道 → pack job(`pnpm build` + pack,`HUSKY: 0`)→ publish job(`changeset publish --from-pack-dir`,逐包 `npm publish`)→ 成功后自动打 git tag(`@pawover/kit-utils@0.0.0-alpha.5` 等)并推送
142
+ 7. **验证**:`npm view @pawover/kit-utils dist-tags --json` 看 tag 落点;Actions 全绿;npmjs 包页出现 Provenance 徽标
143
+
144
+ ### 版本号规则(当前 alpha pre 模式)
145
+
146
+ | bump | 子包(当前 `0.0.0-alpha.4`) | 根包(当前 `0.8.0`) |
147
+ | :--- | :--- | :--- |
148
+ | `patch` | `0.0.0-alpha.5` | `0.8.1-alpha.N` |
149
+ | `minor` | `0.1.0-alpha.0` | `0.9.0-alpha.N` |
150
+ | `major` | `1.0.0-alpha.0` | `1.0.0-alpha.N` |
151
+
152
+ - 子包 A 被发布时,依赖 A 的包(含根包)自动随同 patch 提升——**任何子包发布必伴随根包发布**(CI 硬校验守卫)
153
+ - 已存在于 registry 的版本不会重复发布
154
+
155
+ ### dist-tag 规则
156
+
157
+ | 包 | 当前 `latest` | `alpha` tag |
158
+ | :--- | :--- | :--- |
159
+ | 5 个子包 | `0.0.0-alpha.4`(only-pre:从未出过稳定版,首个 pre 版本直接挂 latest) | `0.0.0-alpha.3` |
160
+ | 根包 `@pawover/kit` | `0.8.0`(有稳定版历史,pre 版本只发 alpha tag,不碰 latest) | — |
161
+
162
+ ### 转正流程(发布正式版)
163
+
164
+ 1. 确认 main 干净(无未合并的 Version PR)
165
+ 2. `pnpm pre:exit` → 提交并 push main(`pnpm pre:enter-alpha` 可随时重新进入)
166
+ 3. 之后照常走日常循环,此时版本号不再带 `-alpha`,发布到 `latest`
167
+ 4. 清理遗留(可选):`npm dist-tag rm <包> alpha` 移除 5 个子包的旧 alpha tag
168
+
169
+ ### 应急手动发布(一般不使用)
170
+
171
+ ```bash
172
+ pnpm build && pnpm postbuild # 构建并同步 entry/metadata.json
173
+ pnpm public # 根包(turbo build && pnpm publish)
174
+ pnpm --filter @pawover/kit-utils publish --tag alpha # 单个子包(本地需登录态,交互式 OTP)
175
+ ```
176
+
177
+ ### 易错点
178
+
179
+ - **Trusted Publisher**(npmjs 后台):Repository 必须是 `pawover-kit`(不是包名)、workflow 必须 `.github/workflows/release.yml`、Environment 留空——任何不一致会导致 CI 发布 E404
180
+ - `release.yml` 的 pack / publish job 已设 `HUSKY: 0`,勿删(否则 `npm pack` 触发根包 husky 直接失败)
181
+ - changeset 忘提交 → 不发布;手动改版本号 → 破坏 tag 对比逻辑,**永远不要**
182
+ - `pnpm changeset version` 需要干净工作区,本地跑之前先提交/暂存
183
+ - 只有本地手动发布才需要 OTP;CI 走 OIDC 不需要
184
+
109
185
  ## 测试
110
186
 
111
187
  - **单元测试**:vitest 双项目(node 环境覆盖 utils / zod / eslint-rules,jsdom 环境覆盖 hooks)
@@ -1 +1 @@
1
- export type * from './eslint-rules.d.ts';
1
+ export type * from './eslint-rules.d.ts';
@@ -1 +1 @@
1
- export type * from './hooks-alova.d.ts';
1
+ export type * from './hooks-alova.d.ts';
@@ -1 +1 @@
1
- export type * from './hooks-react.d.ts';
1
+ export type * from './hooks-react.d.ts';
package/entry/index.d.cts CHANGED
@@ -1 +1 @@
1
- export type * from './index.d.ts';
1
+ export type * from './index.d.ts';
package/entry/math.d.cts CHANGED
@@ -1 +1 @@
1
- export type * from './math.d.ts';
1
+ export type * from './math.d.ts';
@@ -1 +1 @@
1
- export type * from './types-react.d.ts';
1
+ export type * from './types-react.d.ts';
package/entry/types.d.cts CHANGED
@@ -1 +1 @@
1
- export type * from './types.d.ts';
1
+ export type * from './types.d.ts';
package/entry/vite.d.cts CHANGED
@@ -1 +1 @@
1
- export type * from './vite.d.ts';
1
+ export type * from './vite.d.ts';
package/entry/zod.d.cts CHANGED
@@ -1 +1 @@
1
- export type * from './zod.d.ts';
1
+ export type * from './zod.d.ts';
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/pawover"
7
7
  },
8
8
  "description": "一个基于 TypeScript 的开发工具包",
9
- "version": "0.7.0",
9
+ "version": "0.8.1-alpha.5",
10
10
  "type": "module",
11
11
  "engines": {
12
12
  "node": ">=22.20.0"
@@ -158,29 +158,32 @@
158
158
  "./metadata.json": "./entry/metadata.json"
159
159
  },
160
160
  "dependencies": {
161
- "@pawover/kit-eslint-rules": "0.0.0-alpha.3",
162
- "@pawover/kit-hooks": "0.0.0-alpha.3",
163
- "@pawover/kit-utils": "0.0.0-alpha.3",
164
- "@pawover/kit-types": "0.0.0-alpha.3",
165
- "@pawover/kit-zod": "0.0.0-alpha.3"
161
+ "@pawover/kit-hooks": "0.0.0-alpha.5",
162
+ "@pawover/kit-eslint-rules": "0.0.0-alpha.5",
163
+ "@pawover/kit-types": "0.0.0-alpha.5",
164
+ "@pawover/kit-zod": "0.0.0-alpha.5",
165
+ "@pawover/kit-utils": "0.0.0-alpha.5"
166
166
  },
167
167
  "devDependencies": {
168
+ "@arethetypeswrong/cli": "^0.18.5",
169
+ "@changesets/cli": "^3.0.0",
168
170
  "@commitlint/cli": "^21.2.1",
169
171
  "@commitlint/config-conventional": "^21.2.0",
170
- "@eslint-react/eslint-plugin": "^5.18.2",
172
+ "@eslint-react/eslint-plugin": "^5.18.3",
171
173
  "@playwright/test": "^1.62.1",
172
174
  "@stylistic/eslint-plugin": "^6.0.0-beta.5",
173
175
  "@testing-library/react": "^16.3.2",
174
176
  "@types/fs-extra": "^11.0.4",
175
- "@types/node": "^26.1.2",
177
+ "@types/node": "^26.2.0",
176
178
  "@types/react": "^19.2.18",
177
179
  "@vitejs/plugin-react": "^6.0.5",
178
180
  "@vitest/browser-playwright": "^4.1.10",
179
181
  "@vitest/coverage-v8": "^4.1.10",
180
182
  "alova": "^3.5.1",
181
183
  "commitizen": "^4.3.2",
184
+ "cross-env": "^10.1.0",
182
185
  "cz-customizable": "^7.5.4",
183
- "eslint": "^10.8.0",
186
+ "eslint": "^10.8.1",
184
187
  "eslint-plugin-antfu": "^3.2.3",
185
188
  "eslint-plugin-import-lite": "^0.6.0",
186
189
  "eslint-plugin-react-hooks": "^7.1.1",
@@ -193,9 +196,9 @@
193
196
  "react-dom": "19.2.6",
194
197
  "rimraf": "^6.1.3",
195
198
  "tsdown": "^0.22.14",
196
- "turbo": "^2.10.8",
199
+ "turbo": "^2.10.9",
197
200
  "typescript": "^6.0.3",
198
- "typescript-eslint": "^8.66.0",
201
+ "typescript-eslint": "^8.67.0",
199
202
  "vitest": "^4.1.10"
200
203
  },
201
204
  "peerDependencies": {
@@ -222,6 +225,9 @@
222
225
  "optional": true
223
226
  }
224
227
  },
228
+ "publishConfig": {
229
+ "access": "public"
230
+ },
225
231
  "config": {
226
232
  "commitizen": {
227
233
  "path": "node_modules/cz-customizable"
@@ -246,11 +252,16 @@
246
252
  "build:package:force": "turbo build:package --force && pnpm package",
247
253
  "package": "pnpm pack",
248
254
  "public": "turbo build && pnpm publish --access public",
255
+ "changeset": "changeset",
256
+ "ci:version": "pnpm changeset version && node scripts/bump-root.mjs && pnpm install",
257
+ "ci:publish": "pnpm build && pnpm changeset publish",
258
+ "pre:enter-alpha": "pnpm changeset pre enter alpha",
259
+ "pre:exit": "pnpm changeset pre exit",
249
260
  "check": "pnpm check:types & pnpm check:eslint & pnpm check:format",
250
261
  "check:types": "tsc --noEmit",
251
262
  "check:eslint": "eslint --fix \"**/*.{js,cjs,mjs,ts,cts,mts,jsx,tsx,vue}\" --cache-location=.cache/eslint.cache.json --cache",
252
263
  "check:format": "prettier --write \"**/*.{html,json,jsonc}\" --cache-location=.cache/prettier.cache.json --cache",
253
- "check:pack": "pnpm dlx @arethetypeswrong/cli --pack . --profile node16",
264
+ "check:pack": "cross-env HUSKY=0 node scripts/check-pack.mjs",
254
265
  "clean": "pnpm clean:cache & pnpm clean:lib & pnpm clean:output",
255
266
  "clean:turbo": "rimraf -g **/.turbo",
256
267
  "clean:cache": "rimraf -g .cache",