react-util-tools 1.0.2 → 1.0.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/CONTRIBUTING.md +86 -0
- package/package.json +15 -2
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# 贡献指南
|
|
2
|
+
|
|
3
|
+
## 发布新版本
|
|
4
|
+
|
|
5
|
+
### 1. 确保已登录 npm
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm whoami
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
如果未登录:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm login
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### 2. 拉取最新代码
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
git pull origin main
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 3. 修改代码并测试
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# 安装依赖
|
|
27
|
+
npm install
|
|
28
|
+
|
|
29
|
+
# 开发模式
|
|
30
|
+
npm run dev
|
|
31
|
+
|
|
32
|
+
# 构建测试
|
|
33
|
+
npm run build
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 4. 提交代码
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
git add .
|
|
40
|
+
git commit -m "feat: 添加新功能"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 5. 发布新版本
|
|
44
|
+
|
|
45
|
+
根据改动类型选择:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# 修复 bug: 1.0.3 -> 1.0.4
|
|
49
|
+
npm run release
|
|
50
|
+
# 或
|
|
51
|
+
npm run release:patch
|
|
52
|
+
|
|
53
|
+
# 新功能: 1.0.3 -> 1.1.0
|
|
54
|
+
npm run release:minor
|
|
55
|
+
|
|
56
|
+
# 破坏性更新: 1.0.3 -> 2.0.0
|
|
57
|
+
npm run release:major
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
这个命令会自动:
|
|
61
|
+
- ✅ 更新版本号
|
|
62
|
+
- ✅ 构建项目
|
|
63
|
+
- ✅ 推送到 GitHub(包含 tag)
|
|
64
|
+
- ✅ 发布到 npm
|
|
65
|
+
|
|
66
|
+
### 6. 验证发布
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm view react-util-tools
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 版本号规范
|
|
73
|
+
|
|
74
|
+
遵循 [语义化版本](https://semver.org/lang/zh-CN/):
|
|
75
|
+
|
|
76
|
+
- **MAJOR**: 不兼容的 API 修改
|
|
77
|
+
- **MINOR**: 向下兼容的功能性新增
|
|
78
|
+
- **PATCH**: 向下兼容的问题修正
|
|
79
|
+
|
|
80
|
+
## 注意事项
|
|
81
|
+
|
|
82
|
+
- ⚠️ 发布前务必测试代码
|
|
83
|
+
- ⚠️ 确保代码已提交到 git
|
|
84
|
+
- ⚠️ 不要直接修改 `dist/` 目录
|
|
85
|
+
- ⚠️ 发布后无法撤销,请谨慎操作
|
|
86
|
+
- ⚠️ 使用 `npm run release` 命令会自动构建和发布
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-util-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "A collection of useful utilities: throttle, debounce, date formatting, device detection, money formatting, decimal calculations and more",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -16,7 +16,12 @@
|
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
19
|
-
"dev": "tsup src/index.ts --watch"
|
|
19
|
+
"dev": "tsup src/index.ts --watch",
|
|
20
|
+
"prepublishOnly": "npm run build",
|
|
21
|
+
"release:patch": "npm version patch && git push --follow-tags && npm publish",
|
|
22
|
+
"release:minor": "npm version minor && git push --follow-tags && npm publish",
|
|
23
|
+
"release:major": "npm version major && git push --follow-tags && npm publish",
|
|
24
|
+
"release": "npm run release:patch"
|
|
20
25
|
},
|
|
21
26
|
"keywords": [
|
|
22
27
|
"react",
|
|
@@ -35,6 +40,14 @@
|
|
|
35
40
|
],
|
|
36
41
|
"author": "alice & bobby",
|
|
37
42
|
"license": "MIT",
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+https://github.com/dj49846917/react-util-tools.git"
|
|
46
|
+
},
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/dj49846917/react-util-tools/issues"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/dj49846917/react-util-tools#readme",
|
|
38
51
|
"publishConfig": {
|
|
39
52
|
"access": "public",
|
|
40
53
|
"registry": "https://registry.npmjs.org/"
|