@pawover/kit 1.0.0-alpha.0 → 1.0.0
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.en.md +35 -6
- package/README.md +10 -6
- package/package.json +16 -16
package/README.en.md
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="site/public/logo.svg" width="64" alt="pawover-kit logo">
|
|
3
|
+
<h1>pawover-kit</h1>
|
|
4
|
+
<p><a href="README.md">简体中文</a> | <b>English</b></p>
|
|
5
|
+
</div>
|
|
2
6
|
|
|
3
7
|
[](https://www.npmjs.com/package/@pawover/kit)
|
|
4
8
|
[](https://nodejs.org)
|
|
5
9
|
[](LICENSE)
|
|
10
|
+
[](https://pawover.github.io/pawover-kit/)
|
|
6
11
|
|
|
7
12
|
> An open-source TypeScript toolkit: type utilities, static utility classes, React / Alova hooks, ESLint rulesets and Zod schemas, ready to use with complete type definitions.
|
|
8
13
|
|
|
9
14
|
pawover-kit is a pnpm monorepo made of 5 independently publishable packages. The root package `@pawover/kit` re-exports every subpackage, while each subpackage can also be installed and used on its own.
|
|
10
15
|
|
|
16
|
+
> 📚 **Documentation**: [https://pawover.github.io/pawover-kit/](https://pawover.github.io/pawover-kit/) — full API reference, guides and practical examples live on the docs site; this file keeps only the essentials.
|
|
17
|
+
|
|
11
18
|
## Features
|
|
12
19
|
|
|
13
20
|
- **Type-only utilities** `@pawover/kit-types`: no runtime code, providing `AnyObject`, `TreeLike`, the `AnyFunction` family, `AdvancedRecord`, `ApiNameCheck` and more
|
|
14
|
-
- **Static utility classes** `@pawover/kit-utils`:
|
|
21
|
+
- **Static utility classes** `@pawover/kit-utils`: 15+ utility classes covering arrays, strings, objects, trees, currency, dates, math and more
|
|
15
22
|
- **React / Alova hooks** `@pawover/kit-hooks`: `useMount`, `useUnmount`, `useLatest`, `useResponsive`, `useTitle` and Alova request hooks
|
|
16
23
|
- **ESLint rulesets** `@pawover/kit-eslint-rules`: 9 rule groups (javascript / typescript / react / reactHooks / vue / stylistic / antfu / imports / importsSort) plus `GLOB_EXCLUDE` and `createRules`
|
|
17
24
|
- **Zod v4 schemas** `@pawover/kit-zod`: common validators for id, string, number, boolean, bigint and more
|
|
18
25
|
- Dual ESM / CJS builds with full type declarations
|
|
19
|
-
- `
|
|
26
|
+
- `exports` only points to `dist` outputs, resolvable by any toolchain (node / vite / vitest / webpack, etc.)
|
|
20
27
|
|
|
21
28
|
## Packages
|
|
22
29
|
|
|
@@ -100,11 +107,33 @@ Common commands:
|
|
|
100
107
|
|
|
101
108
|
| Command | Description |
|
|
102
109
|
| :--- | :--- |
|
|
103
|
-
| `pnpm test` | Run all vitest suites (
|
|
110
|
+
| `pnpm test` | Run all vitest suites (814 tests / 31 files, node + jsdom environments) |
|
|
104
111
|
| `pnpm test:types` | Type-check the test files |
|
|
105
112
|
| `pnpm test:ci` | Full CI pipeline: type check → tests → build → smoke → pack check |
|
|
106
113
|
| `pnpm build` | Build every subpackage with turbo (tsdown emits ESM/CJS builds and type declarations) |
|
|
107
114
|
| `pnpm check` | Run types / eslint / format checks in parallel |
|
|
115
|
+
| `pnpm docs:dev` | Preview the docs site locally (VitePress, source in `site/`) |
|
|
116
|
+
| `pnpm docs:gen` | Regenerate API reference pages from source JSDoc (re-run after editing source comments) |
|
|
117
|
+
|
|
118
|
+
## Release
|
|
119
|
+
|
|
120
|
+
A **dual-channel release model** driven by Changesets v3 + GitHub Actions (full details in [.changeset/README.md](./.changeset/README.md)):
|
|
121
|
+
|
|
122
|
+
- **feature = alpha pre-release channel**: pushing to `feature` is fully automatic — CI guard (`verify-release-plan.mjs`) → select-mode → version PR → version job merges once CI is green → dispatch triggers publish, releasing under the `alpha` dist-tag
|
|
123
|
+
- **main = stable channel**: code only lands via a **release merge** — `pnpm release:merge` (sync checks → strip prerelease → collision guard → create release-main PR) → **manual merge of the PR** (the human gate for stable releases) → publish `latest` → CI pushes the stable version back to `feature` (baseline sync, next alpha bumps on top of the new stable)
|
|
124
|
+
- **Core design**: there is always a human gate between alpha and stable — no automation ever crosses it
|
|
125
|
+
|
|
126
|
+
Common commands:
|
|
127
|
+
|
|
128
|
+
| Action | Command |
|
|
129
|
+
| :--- | :--- |
|
|
130
|
+
| Write a changeset | `pnpm changeset` |
|
|
131
|
+
| Publish alpha (automatic) | `git push origin feature` |
|
|
132
|
+
| Start a stable release (human gate) | `pnpm release:merge` → manually merge the PR |
|
|
133
|
+
| Baseline sync | Automatic (CI pushes back after a main release); manual fallback: `git merge origin/main` on `feature` (take the main-side version) |
|
|
134
|
+
| Emergency manual release | `pnpm pre:enter-alpha && pnpm build && pnpm changeset publish` |
|
|
135
|
+
|
|
136
|
+
> Trusted Publishing / OIDC: no npm token is ever needed; branch protection, guard details and FAQ live in `.changeset/README.md`.
|
|
108
137
|
|
|
109
138
|
## Testing
|
|
110
139
|
|
|
@@ -114,10 +143,10 @@ Common commands:
|
|
|
114
143
|
|
|
115
144
|
## Build pipeline
|
|
116
145
|
|
|
117
|
-
```
|
|
146
|
+
```text
|
|
118
147
|
tsdown (build:source) → metadata extraction (build:metadata) → turbo build
|
|
119
148
|
```
|
|
120
149
|
|
|
121
150
|
- **tsdown** produces the bundles and type declarations
|
|
122
151
|
- **sync-entry.ts** (root postbuild) reads the runtime exports of utils / hooks from dist and writes `entry/metadata.json` and `entry/hooks-metadata.json`
|
|
123
|
-
- In-repo tests (`test:types` / vitest) resolve the source directly via tsconfig `paths` and `resolve.alias` — no build needed before testing
|
|
152
|
+
- In-repo tests (`test:types` / vitest) resolve the source directly via tsconfig `paths` and `resolve.alias` — no build needed before testing
|
package/README.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="site/public/logo.svg" width="64" alt="pawover-kit logo">
|
|
3
|
+
<h1>pawover-kit</h1>
|
|
4
|
+
<p><b>简体中文</b> | <a href="README.en.md">English</a></p>
|
|
5
|
+
</div>
|
|
2
6
|
|
|
3
7
|
[](https://www.npmjs.com/package/@pawover/kit)
|
|
4
8
|
[](https://nodejs.org)
|
|
@@ -14,7 +18,7 @@ pawover-kit 是一个 pnpm 单体仓库(monorepo),由 5 个独立可发布
|
|
|
14
18
|
## 特性
|
|
15
19
|
|
|
16
20
|
- **纯类型工具** `@pawover/kit-types`:无运行时代码,提供 `AnyObject`、`TreeLike`、`AnyFunction` 族、`AdvancedRecord`、`ApiNameCheck` 等常用类型
|
|
17
|
-
- **静态工具类** `@pawover/kit-utils`:数组、字符串、对象、树、货币、日期、数学等
|
|
21
|
+
- **静态工具类** `@pawover/kit-utils`:数组、字符串、对象、树、货币、日期、数学等 15+ 个工具类
|
|
18
22
|
- **React / Alova Hooks** `@pawover/kit-hooks`:`useMount`、`useUnmount`、`useLatest`、`useResponsive`、`useTitle` 与 Alova 请求系列 Hooks
|
|
19
23
|
- **ESLint 规则集** `@pawover/kit-eslint-rules`:9 大规则组(javascript / typescript / react / reactHooks / vue / stylistic / antfu / imports / importsSort)+ `GLOB_EXCLUDE` + `createRules`
|
|
20
24
|
- **Zod v4 Schema** `@pawover/kit-zod`:id、string、number、boolean、bigint 等常用校验器
|
|
@@ -103,12 +107,12 @@ pnpm install
|
|
|
103
107
|
|
|
104
108
|
| 命令 | 说明 |
|
|
105
109
|
| :--- | :--- |
|
|
106
|
-
| `pnpm test` | vitest 全量运行(
|
|
110
|
+
| `pnpm test` | vitest 全量运行(814 条测试 / 31 个文件,node + jsdom 双环境) |
|
|
107
111
|
| `pnpm test:types` | 测试文件的类型检查 |
|
|
108
112
|
| `pnpm test:ci` | 完整 CI 流程:类型检查 → 测试 → 构建 → 冒烟 → pack 检查 |
|
|
109
113
|
| `pnpm build` | turbo 构建全部子包(tsdown 生成 ESM/CJS 双格式与类型声明) |
|
|
110
114
|
| `pnpm check` | 并行运行 types / eslint / format 检查 |
|
|
111
|
-
| `pnpm docs:dev` | 本地预览文档站(VitePress,源码见 `
|
|
115
|
+
| `pnpm docs:dev` | 本地预览文档站(VitePress,源码见 `site/`) |
|
|
112
116
|
| `pnpm docs:gen` | 从源码 JSDoc 重新生成 API 参考页(改源码注释后需重新生成) |
|
|
113
117
|
|
|
114
118
|
## 发布
|
|
@@ -139,10 +143,10 @@ pnpm install
|
|
|
139
143
|
|
|
140
144
|
## 构建流水线
|
|
141
145
|
|
|
142
|
-
```
|
|
146
|
+
```text
|
|
143
147
|
tsdown (build:source) → metadata 提取 (build:metadata) → turbo build
|
|
144
148
|
```
|
|
145
149
|
|
|
146
150
|
- **tsdown** 负责打包与类型声明生成
|
|
147
151
|
- **sync-entry.ts**(根 postbuild)读取 utils / hooks 的 dist 导出名,生成 `entry/metadata.json` 与 `entry/hooks-metadata.json`
|
|
148
|
-
- 仓库内测试(`test:types` / vitest)经 tsconfig `paths` 与 `resolve.alias` 直查源码,改源码无需先构建
|
|
152
|
+
- 仓库内测试(`test:types` / vitest)经 tsconfig `paths` 与 `resolve.alias` 直查源码,改源码无需先构建
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://github.com/pawover"
|
|
7
7
|
},
|
|
8
8
|
"description": "一个基于 TypeScript 的开发工具包",
|
|
9
|
-
"version": "1.0.0
|
|
9
|
+
"version": "1.0.0",
|
|
10
10
|
"type": "module",
|
|
11
11
|
"engines": {
|
|
12
12
|
"node": ">=22.20.0"
|
|
@@ -158,18 +158,18 @@
|
|
|
158
158
|
"./metadata.json": "./entry/metadata.json"
|
|
159
159
|
},
|
|
160
160
|
"dependencies": {
|
|
161
|
-
"@pawover/kit-eslint-rules": "0.0.5
|
|
161
|
+
"@pawover/kit-eslint-rules": "0.0.5",
|
|
162
|
+
"@pawover/kit-hooks": "0.0.8",
|
|
162
163
|
"@pawover/kit-types": "0.0.4",
|
|
163
|
-
"@pawover/kit-utils": "1.0.0
|
|
164
|
-
"@pawover/kit-zod": "0.0.4"
|
|
165
|
-
"@pawover/kit-hooks": "0.0.8-alpha.0"
|
|
164
|
+
"@pawover/kit-utils": "1.0.0",
|
|
165
|
+
"@pawover/kit-zod": "0.0.4"
|
|
166
166
|
},
|
|
167
167
|
"devDependencies": {
|
|
168
168
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
169
|
-
"@changesets/cli": "^3.0.
|
|
170
|
-
"@commitlint/cli": "^21.2.
|
|
171
|
-
"@commitlint/config-conventional": "^21.2.
|
|
172
|
-
"@eslint-react/eslint-plugin": "^5.18.
|
|
169
|
+
"@changesets/cli": "^3.0.1",
|
|
170
|
+
"@commitlint/cli": "^21.2.2",
|
|
171
|
+
"@commitlint/config-conventional": "^21.2.2",
|
|
172
|
+
"@eslint-react/eslint-plugin": "^5.18.6",
|
|
173
173
|
"@fontsource/ibm-plex-mono": "^5.3.0",
|
|
174
174
|
"@playwright/test": "^1.62.1",
|
|
175
175
|
"@stylistic/eslint-plugin": "^6.0.0-beta.5",
|
|
@@ -178,8 +178,8 @@
|
|
|
178
178
|
"@types/node": "^26.2.0",
|
|
179
179
|
"@types/react": "^19.2.18",
|
|
180
180
|
"@vitejs/plugin-react": "^6.0.5",
|
|
181
|
-
"@vitest/browser-playwright": "^4.1.
|
|
182
|
-
"@vitest/coverage-v8": "^4.1.
|
|
181
|
+
"@vitest/browser-playwright": "^4.1.11",
|
|
182
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
183
183
|
"alova": "^3.5.1",
|
|
184
184
|
"commitizen": "^4.3.2",
|
|
185
185
|
"cross-env": "^10.1.0",
|
|
@@ -197,13 +197,13 @@
|
|
|
197
197
|
"react-dom": "19.2.6",
|
|
198
198
|
"rimraf": "^6.1.3",
|
|
199
199
|
"tsdown": "^0.22.14",
|
|
200
|
-
"turbo": "^2.10.
|
|
200
|
+
"turbo": "^2.10.11",
|
|
201
201
|
"typedoc": "^0.28.20",
|
|
202
202
|
"typedoc-plugin-markdown": "^4.12.0",
|
|
203
203
|
"typescript": "^6.0.3",
|
|
204
204
|
"typescript-eslint": "^8.67.0",
|
|
205
205
|
"vitepress": "^1.6.4",
|
|
206
|
-
"vitest": "^4.1.
|
|
206
|
+
"vitest": "^4.1.11"
|
|
207
207
|
},
|
|
208
208
|
"peerDependencies": {
|
|
209
209
|
"alova": "^3.5.1",
|
|
@@ -261,9 +261,9 @@
|
|
|
261
261
|
"pre:enter-alpha": "pnpm changeset pre enter alpha",
|
|
262
262
|
"pre:exit": "pnpm changeset pre exit",
|
|
263
263
|
"release:merge": "node scripts/release-merge.mjs",
|
|
264
|
-
"docs:dev": "vitepress dev
|
|
265
|
-
"docs:build": "vitepress build
|
|
266
|
-
"docs:preview": "vitepress preview
|
|
264
|
+
"docs:dev": "vitepress dev site",
|
|
265
|
+
"docs:build": "vitepress build site",
|
|
266
|
+
"docs:preview": "vitepress preview site",
|
|
267
267
|
"docs:gen": "node scripts/generate-docs.mjs",
|
|
268
268
|
"check": "pnpm check:types & pnpm check:eslint & pnpm check:format",
|
|
269
269
|
"check:types": "tsc --noEmit",
|