@varlet/release 0.0.3 → 0.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/LICENCE +21 -21
- package/README.md +125 -116
- package/README.zh-CN.md +125 -116
- package/bin/index.js +6 -1
- package/dist/index.cjs +56 -0
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +52 -0
- package/package.json +16 -6
package/LICENCE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 varlet
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 varlet
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,116 +1,125 @@
|
|
|
1
|
-
<h1 align="center">Varlet Release</h1>
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<span>English</span> |
|
|
5
|
-
<a href="https://github.com/varletjs/release/blob/main/README.zh-CN.md">中文</a>
|
|
6
|
-
</p>
|
|
7
|
-
<p align="center">
|
|
8
|
-
<a href="https://www.npmjs.com/package/@varlet/release" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/npm/v/@varlet/release" alt="NPM Version" /></a>
|
|
9
|
-
<a href="https://github.com/varletjs/release/blob/main/LICENCE" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/github/license/varletjs/release" alt="License" /></a>
|
|
10
|
-
</p>
|
|
11
|
-
|
|
12
|
-
## Intro
|
|
13
|
-
|
|
14
|
-
`Varlet Release` is a tool to release all packages and
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
### npm
|
|
19
|
-
|
|
20
|
-
```shell
|
|
21
|
-
npm i @varlet/release -D
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### yarn
|
|
25
|
-
|
|
26
|
-
```shell
|
|
27
|
-
yarn add @varlet/release -D
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### pnpm
|
|
31
|
-
|
|
32
|
-
```shell
|
|
33
|
-
pnpm add @varlet/release -D
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Usage
|
|
37
|
-
|
|
38
|
-
### Using Command
|
|
39
|
-
|
|
40
|
-
```shell
|
|
41
|
-
# Release all packages and generate changelogs
|
|
42
|
-
npx vr release
|
|
43
|
-
|
|
44
|
-
# Specify remote name
|
|
45
|
-
npx vr release -r <remote>
|
|
46
|
-
# or
|
|
47
|
-
npx vr release --remote <remote>
|
|
48
|
-
|
|
49
|
-
# Just generate changelogs
|
|
50
|
-
npx vr changelog
|
|
51
|
-
|
|
52
|
-
# Specify changelog filename
|
|
53
|
-
npx vr changelog -f <filename>
|
|
54
|
-
# or
|
|
55
|
-
npx vr changelog --file <filename>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
####
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
1
|
+
<h1 align="center">Varlet Release</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<span>English</span> |
|
|
5
|
+
<a href="https://github.com/varletjs/release/blob/main/README.zh-CN.md">中文</a>
|
|
6
|
+
</p>
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/@varlet/release" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/npm/v/@varlet/release" alt="NPM Version" /></a>
|
|
9
|
+
<a href="https://github.com/varletjs/release/blob/main/LICENCE" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/github/license/varletjs/release" alt="License" /></a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
## Intro
|
|
13
|
+
|
|
14
|
+
`Varlet Release` is a tool to release all packages, generate changelogs and lint commit message.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
### npm
|
|
19
|
+
|
|
20
|
+
```shell
|
|
21
|
+
npm i @varlet/release -D
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### yarn
|
|
25
|
+
|
|
26
|
+
```shell
|
|
27
|
+
yarn add @varlet/release -D
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### pnpm
|
|
31
|
+
|
|
32
|
+
```shell
|
|
33
|
+
pnpm add @varlet/release -D
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
### Using Command
|
|
39
|
+
|
|
40
|
+
```shell
|
|
41
|
+
# Release all packages and generate changelogs
|
|
42
|
+
npx vr release
|
|
43
|
+
|
|
44
|
+
# Specify remote name
|
|
45
|
+
npx vr release -r <remote>
|
|
46
|
+
# or
|
|
47
|
+
npx vr release --remote <remote>
|
|
48
|
+
|
|
49
|
+
# Just generate changelogs
|
|
50
|
+
npx vr changelog
|
|
51
|
+
|
|
52
|
+
# Specify changelog filename
|
|
53
|
+
npx vr changelog -f <filename>
|
|
54
|
+
# or
|
|
55
|
+
npx vr changelog --file <filename>
|
|
56
|
+
|
|
57
|
+
# Lint commit message
|
|
58
|
+
npx vr lint-commit <gitMessagePath>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Configuration
|
|
62
|
+
|
|
63
|
+
#### release
|
|
64
|
+
|
|
65
|
+
| Params | Instructions |
|
|
66
|
+
| ---------------------- | ------------------- |
|
|
67
|
+
| -r --remote \<remote\> | Specify remote name |
|
|
68
|
+
|
|
69
|
+
#### changelog
|
|
70
|
+
|
|
71
|
+
| Params | Instructions |
|
|
72
|
+
| ----------------------------------- | -------------------------- |
|
|
73
|
+
| -f --file \<filename\> | Specify changelog filename |
|
|
74
|
+
| -rc --releaseCount \<releaseCount\> | Release count |
|
|
75
|
+
|
|
76
|
+
#### lint-commit
|
|
77
|
+
|
|
78
|
+
| Params | Instructions |
|
|
79
|
+
| ------------------ | ---------------------------------------------------------------------------------------------------------------------- |
|
|
80
|
+
| \<gitMessagePath\> | The path of the temporary file to which the git message is submitted. The git hook commit-msg will pass this parameter |
|
|
81
|
+
|
|
82
|
+
### Custom Handle
|
|
83
|
+
|
|
84
|
+
#### Example
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
import { release, changelog } from '@varlet/release'
|
|
88
|
+
|
|
89
|
+
// Do what you want to do...
|
|
90
|
+
release()
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
You can pass in a task that will be called before the publish after the package version is changed.
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
import { release, changelog } from '@varlet/release'
|
|
97
|
+
|
|
98
|
+
async function task() {
|
|
99
|
+
await doSomething1()
|
|
100
|
+
await doSomething2()
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
release({ task })
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### Types
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
interface ReleaseCommandOptions {
|
|
110
|
+
remote?: string
|
|
111
|
+
task?(): Promise<void>
|
|
112
|
+
}
|
|
113
|
+
function release(options: ReleaseCommandOptions): Promise<void>
|
|
114
|
+
|
|
115
|
+
interface ChangelogCommandOptions {
|
|
116
|
+
file?: string
|
|
117
|
+
releaseCount?: number
|
|
118
|
+
}
|
|
119
|
+
function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
|
|
120
|
+
function commitLint(gitMessagePath: string): void
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
[MIT](https://github.com/varletjs/release/blob/main/LICENCE)
|
package/README.zh-CN.md
CHANGED
|
@@ -1,116 +1,125 @@
|
|
|
1
|
-
<h1 align="center">Varlet Release</h1>
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<span>中文</span> |
|
|
5
|
-
<a href="https://github.com/varletjs/release/blob/main/README.md">English</a>
|
|
6
|
-
</p>
|
|
7
|
-
<p align="center">
|
|
8
|
-
<a href="https://www.npmjs.com/package/@varlet/release" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/npm/v/@varlet/release" alt="NPM Version" /></a>
|
|
9
|
-
<a href="https://github.com/valetjs/release/blob/master/LICENSE" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/github/license/varletjs/release" alt="License" /></a>
|
|
10
|
-
</p>
|
|
11
|
-
|
|
12
|
-
## 介绍
|
|
13
|
-
|
|
14
|
-
`Varlet Release`
|
|
15
|
-
|
|
16
|
-
## 安装
|
|
17
|
-
|
|
18
|
-
### npm
|
|
19
|
-
|
|
20
|
-
```shell
|
|
21
|
-
npm i @varlet/release -D
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### yarn
|
|
25
|
-
|
|
26
|
-
```shell
|
|
27
|
-
yarn add @varlet/release -D
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### pnpm
|
|
31
|
-
|
|
32
|
-
```shell
|
|
33
|
-
pnpm add @varlet/release -D
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## 使用
|
|
37
|
-
|
|
38
|
-
### 使用命令
|
|
39
|
-
|
|
40
|
-
```shell
|
|
41
|
-
# 发布所有包并生成变更日志
|
|
42
|
-
npx vr release
|
|
43
|
-
|
|
44
|
-
# 指定远程仓库名称
|
|
45
|
-
npx vr release -r <remote>
|
|
46
|
-
# or
|
|
47
|
-
npx vr release --remote <remote>
|
|
48
|
-
|
|
49
|
-
# 仅生成变更日志
|
|
50
|
-
npx vr changelog
|
|
51
|
-
|
|
52
|
-
# 指定变更日志文件名
|
|
53
|
-
npx vr changelog -f <filename>
|
|
54
|
-
# or
|
|
55
|
-
npx vr changelog --file <filename>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
####
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
1
|
+
<h1 align="center">Varlet Release</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<span>中文</span> |
|
|
5
|
+
<a href="https://github.com/varletjs/release/blob/main/README.md">English</a>
|
|
6
|
+
</p>
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/@varlet/release" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/npm/v/@varlet/release" alt="NPM Version" /></a>
|
|
9
|
+
<a href="https://github.com/valetjs/release/blob/master/LICENSE" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/github/license/varletjs/release" alt="License" /></a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
## 介绍
|
|
13
|
+
|
|
14
|
+
`Varlet Release` 是一个用于发布所有包、生成变更日志和检测 `commit message` 的工具。
|
|
15
|
+
|
|
16
|
+
## 安装
|
|
17
|
+
|
|
18
|
+
### npm
|
|
19
|
+
|
|
20
|
+
```shell
|
|
21
|
+
npm i @varlet/release -D
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### yarn
|
|
25
|
+
|
|
26
|
+
```shell
|
|
27
|
+
yarn add @varlet/release -D
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### pnpm
|
|
31
|
+
|
|
32
|
+
```shell
|
|
33
|
+
pnpm add @varlet/release -D
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 使用
|
|
37
|
+
|
|
38
|
+
### 使用命令
|
|
39
|
+
|
|
40
|
+
```shell
|
|
41
|
+
# 发布所有包并生成变更日志
|
|
42
|
+
npx vr release
|
|
43
|
+
|
|
44
|
+
# 指定远程仓库名称
|
|
45
|
+
npx vr release -r <remote>
|
|
46
|
+
# or
|
|
47
|
+
npx vr release --remote <remote>
|
|
48
|
+
|
|
49
|
+
# 仅生成变更日志
|
|
50
|
+
npx vr changelog
|
|
51
|
+
|
|
52
|
+
# 指定变更日志文件名
|
|
53
|
+
npx vr changelog -f <filename>
|
|
54
|
+
# or
|
|
55
|
+
npx vr changelog --file <filename>
|
|
56
|
+
|
|
57
|
+
# 检测 commit message
|
|
58
|
+
npx vr lint-commit <gitMessagePath>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 配置
|
|
62
|
+
|
|
63
|
+
#### release
|
|
64
|
+
|
|
65
|
+
| 参数 | 说明 |
|
|
66
|
+
| ---------------------- | ---------------- |
|
|
67
|
+
| -r --remote \<remote\> | 指定远程仓库名称 |
|
|
68
|
+
|
|
69
|
+
#### changelog
|
|
70
|
+
|
|
71
|
+
| 参数 | 说明 |
|
|
72
|
+
| ----------------------------------- | ------------------ |
|
|
73
|
+
| -f --file \<filename\> | 指定变更日志文件名 |
|
|
74
|
+
| -rc --releaseCount \<releaseCount\> | 发布数量 |
|
|
75
|
+
|
|
76
|
+
#### lint-commit
|
|
77
|
+
|
|
78
|
+
| 参数 | 说明 |
|
|
79
|
+
| ------------------ | --------------------------------------------------------------------------- |
|
|
80
|
+
| \<gitMessagePath\> | 提交 `git message` 的临时文件路径。`git` 钩子 `commit-msg` 会传递这个参数。 |
|
|
81
|
+
|
|
82
|
+
### 自定义处理
|
|
83
|
+
|
|
84
|
+
#### 示例
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
import { release, changelog } from '@varlet/release'
|
|
88
|
+
|
|
89
|
+
// Do what you want to do...
|
|
90
|
+
release()
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
你可以传入一个 `task`,在包版本更改后,在发布之前会调用 `task`。
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
import { release, changelog } from '@varlet/release'
|
|
97
|
+
|
|
98
|
+
async function task() {
|
|
99
|
+
await doSomething1()
|
|
100
|
+
await doSomething2()
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
release({ task })
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### 类型
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
interface ReleaseCommandOptions {
|
|
110
|
+
remote?: string
|
|
111
|
+
task?(): Promise<void>
|
|
112
|
+
}
|
|
113
|
+
function release(options: ReleaseCommandOptions): Promise<void>
|
|
114
|
+
|
|
115
|
+
interface ChangelogCommandOptions {
|
|
116
|
+
file?: string
|
|
117
|
+
releaseCount?: number
|
|
118
|
+
}
|
|
119
|
+
function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
|
|
120
|
+
function commitLint(gitMessagePath: string): void
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
[MIT](https://github.com/varletjs/release/blob/main/LICENSE)
|
package/bin/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { release, changelog } from '../dist/index.js'
|
|
2
|
+
import { release, changelog, commitLint } from '../dist/index.js'
|
|
3
3
|
import { Command } from 'commander'
|
|
4
4
|
|
|
5
5
|
const program = new Command()
|
|
@@ -17,4 +17,9 @@ program
|
|
|
17
17
|
.description('Generate changelog')
|
|
18
18
|
.action(async (options) => changelog(options))
|
|
19
19
|
|
|
20
|
+
program
|
|
21
|
+
.command('commit-lint <gitMessagePath>')
|
|
22
|
+
.description('Lint commit message')
|
|
23
|
+
.action(async (option) => commitLint(option))
|
|
24
|
+
|
|
20
25
|
program.parse()
|
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
COMMIT_MESSAGE_RE: () => COMMIT_MESSAGE_RE,
|
|
33
34
|
changelog: () => changelog,
|
|
35
|
+
commitLint: () => commitLint,
|
|
36
|
+
getCommitMessage: () => getCommitMessage,
|
|
37
|
+
isVersionCommitMessage: () => isVersionCommitMessage,
|
|
34
38
|
release: () => release
|
|
35
39
|
});
|
|
36
40
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -226,8 +230,60 @@ async function release(options) {
|
|
|
226
230
|
process.exit(1);
|
|
227
231
|
}
|
|
228
232
|
}
|
|
233
|
+
|
|
234
|
+
// src/commitLint.ts
|
|
235
|
+
var import_semver2 = __toESM(require("semver"), 1);
|
|
236
|
+
var import_fs_extra3 = __toESM(require("fs-extra"), 1);
|
|
237
|
+
var { readFileSync } = import_fs_extra3.default;
|
|
238
|
+
var COMMIT_MESSAGE_RE = /^(revert|fix|feat|docs|perf|test|types|style|build|chore|release|refactor)(\(.+\))?!?: (.|\n)+/;
|
|
239
|
+
function isVersionCommitMessage(message) {
|
|
240
|
+
return message.startsWith("v") && import_semver2.default.valid(message.slice(1));
|
|
241
|
+
}
|
|
242
|
+
function getCommitMessage(gitMessagePath) {
|
|
243
|
+
return readFileSync(gitMessagePath, "utf-8").trim();
|
|
244
|
+
}
|
|
245
|
+
function commitLint(gitMessagePath) {
|
|
246
|
+
const commitMessage = getCommitMessage(gitMessagePath);
|
|
247
|
+
if (!isVersionCommitMessage(commitMessage) && !COMMIT_MESSAGE_RE.test(commitMessage)) {
|
|
248
|
+
logger_default.error(`Commit message invalid`);
|
|
249
|
+
logger_default.warning(`The rules for commit messages are as follows
|
|
250
|
+
|
|
251
|
+
Example:
|
|
252
|
+
|
|
253
|
+
feat: add a new feature
|
|
254
|
+
feat(ui/button): add a new feature in the ui/button scope
|
|
255
|
+
|
|
256
|
+
fix: fix a bug
|
|
257
|
+
fix(ui/button): fix a bug in the ui/button scope
|
|
258
|
+
|
|
259
|
+
docs: fix an error in the documentation
|
|
260
|
+
docs(ui/button): fix a documentation error in the ui/button scope
|
|
261
|
+
|
|
262
|
+
Allowed types:
|
|
263
|
+
- fix
|
|
264
|
+
- feat
|
|
265
|
+
- docs
|
|
266
|
+
- perf
|
|
267
|
+
- test
|
|
268
|
+
- types
|
|
269
|
+
- style
|
|
270
|
+
- build
|
|
271
|
+
- chore
|
|
272
|
+
- release
|
|
273
|
+
- refactor
|
|
274
|
+
- revert
|
|
275
|
+
|
|
276
|
+
Commit message reference: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y
|
|
277
|
+
\u53C2\u8003\u962E\u4E00\u5CF0Commit message\u7F16\u5199\u6307\u5357: https://www.ruanyifeng.com/blog/2016/01/commit_message_change_log.html`);
|
|
278
|
+
process.exit(1);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
229
281
|
// Annotate the CommonJS export names for ESM import in node:
|
|
230
282
|
0 && (module.exports = {
|
|
283
|
+
COMMIT_MESSAGE_RE,
|
|
231
284
|
changelog,
|
|
285
|
+
commitLint,
|
|
286
|
+
getCommitMessage,
|
|
287
|
+
isVersionCommitMessage,
|
|
232
288
|
release
|
|
233
289
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -10,4 +10,9 @@ interface ChangelogCommandOptions {
|
|
|
10
10
|
}
|
|
11
11
|
declare function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
declare const COMMIT_MESSAGE_RE: RegExp;
|
|
14
|
+
declare function isVersionCommitMessage(message: string): string | false | null;
|
|
15
|
+
declare function getCommitMessage(gitMessagePath: string): string;
|
|
16
|
+
declare function commitLint(gitMessagePath: string): void;
|
|
17
|
+
|
|
18
|
+
export { COMMIT_MESSAGE_RE, type ChangelogCommandOptions, type ReleaseCommandOptions, changelog, commitLint, getCommitMessage, isVersionCommitMessage, release };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,4 +10,9 @@ interface ChangelogCommandOptions {
|
|
|
10
10
|
}
|
|
11
11
|
declare function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
declare const COMMIT_MESSAGE_RE: RegExp;
|
|
14
|
+
declare function isVersionCommitMessage(message: string): string | false | null;
|
|
15
|
+
declare function getCommitMessage(gitMessagePath: string): string;
|
|
16
|
+
declare function commitLint(gitMessagePath: string): void;
|
|
17
|
+
|
|
18
|
+
export { COMMIT_MESSAGE_RE, type ChangelogCommandOptions, type ReleaseCommandOptions, changelog, commitLint, getCommitMessage, isVersionCommitMessage, release };
|
package/dist/index.js
CHANGED
|
@@ -189,7 +189,59 @@ async function release(options) {
|
|
|
189
189
|
process.exit(1);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
+
|
|
193
|
+
// src/commitLint.ts
|
|
194
|
+
import semver2 from "semver";
|
|
195
|
+
import fse3 from "fs-extra";
|
|
196
|
+
var { readFileSync } = fse3;
|
|
197
|
+
var COMMIT_MESSAGE_RE = /^(revert|fix|feat|docs|perf|test|types|style|build|chore|release|refactor)(\(.+\))?!?: (.|\n)+/;
|
|
198
|
+
function isVersionCommitMessage(message) {
|
|
199
|
+
return message.startsWith("v") && semver2.valid(message.slice(1));
|
|
200
|
+
}
|
|
201
|
+
function getCommitMessage(gitMessagePath) {
|
|
202
|
+
return readFileSync(gitMessagePath, "utf-8").trim();
|
|
203
|
+
}
|
|
204
|
+
function commitLint(gitMessagePath) {
|
|
205
|
+
const commitMessage = getCommitMessage(gitMessagePath);
|
|
206
|
+
if (!isVersionCommitMessage(commitMessage) && !COMMIT_MESSAGE_RE.test(commitMessage)) {
|
|
207
|
+
logger_default.error(`Commit message invalid`);
|
|
208
|
+
logger_default.warning(`The rules for commit messages are as follows
|
|
209
|
+
|
|
210
|
+
Example:
|
|
211
|
+
|
|
212
|
+
feat: add a new feature
|
|
213
|
+
feat(ui/button): add a new feature in the ui/button scope
|
|
214
|
+
|
|
215
|
+
fix: fix a bug
|
|
216
|
+
fix(ui/button): fix a bug in the ui/button scope
|
|
217
|
+
|
|
218
|
+
docs: fix an error in the documentation
|
|
219
|
+
docs(ui/button): fix a documentation error in the ui/button scope
|
|
220
|
+
|
|
221
|
+
Allowed types:
|
|
222
|
+
- fix
|
|
223
|
+
- feat
|
|
224
|
+
- docs
|
|
225
|
+
- perf
|
|
226
|
+
- test
|
|
227
|
+
- types
|
|
228
|
+
- style
|
|
229
|
+
- build
|
|
230
|
+
- chore
|
|
231
|
+
- release
|
|
232
|
+
- refactor
|
|
233
|
+
- revert
|
|
234
|
+
|
|
235
|
+
Commit message reference: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y
|
|
236
|
+
\u53C2\u8003\u962E\u4E00\u5CF0Commit message\u7F16\u5199\u6307\u5357: https://www.ruanyifeng.com/blog/2016/01/commit_message_change_log.html`);
|
|
237
|
+
process.exit(1);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
192
240
|
export {
|
|
241
|
+
COMMIT_MESSAGE_RE,
|
|
193
242
|
changelog,
|
|
243
|
+
commitLint,
|
|
244
|
+
getCommitMessage,
|
|
245
|
+
isVersionCommitMessage,
|
|
194
246
|
release
|
|
195
247
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/release",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"description": "release all packages and generate changelogs",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"varlet",
|
|
@@ -31,6 +31,14 @@
|
|
|
31
31
|
"files": [
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
|
+
"simple-git-hooks": {
|
|
35
|
+
"pre-commit": "pnpm exec lint-staged --allow-empty --concurrent false",
|
|
36
|
+
"commit-msg": "pnpm run commit-lint $1"
|
|
37
|
+
},
|
|
38
|
+
"lint-staged": {
|
|
39
|
+
"*.{ts,tsx,js,vue,less}": "prettier --write",
|
|
40
|
+
"*.{ts,tsx,js,vue}": "eslint --fix"
|
|
41
|
+
},
|
|
34
42
|
"packageManager": "pnpm@8.7.5",
|
|
35
43
|
"engines": {
|
|
36
44
|
"node": ">=16.0.0",
|
|
@@ -44,28 +52,30 @@
|
|
|
44
52
|
"@types/semver": "^7.5.5",
|
|
45
53
|
"@varlet/eslint-config": "^2.18.4",
|
|
46
54
|
"eslint": "^8.53.0",
|
|
55
|
+
"lint-staged": "^15.2.0",
|
|
47
56
|
"prettier": "^3.1.0",
|
|
57
|
+
"simple-git-hooks": "^2.9.0",
|
|
58
|
+
"tsup": "^8.0.1",
|
|
48
59
|
"typescript": "^5.2.2",
|
|
49
60
|
"unbuild": "^2.0.0"
|
|
50
61
|
},
|
|
51
62
|
"dependencies": {
|
|
52
63
|
"commander": "^11.1.0",
|
|
53
64
|
"conventional-changelog": "^5.1.0",
|
|
54
|
-
"picocolors": "^1.0.0",
|
|
55
65
|
"execa": "^8.0.1",
|
|
56
66
|
"fs-extra": "^11.1.1",
|
|
57
67
|
"glob": "^10.3.10",
|
|
58
68
|
"inquirer": "^9.2.12",
|
|
59
69
|
"nanospinner": "^1.1.0",
|
|
60
|
-
"
|
|
61
|
-
"semver": "^7.5.4"
|
|
62
|
-
"tsup": "^7.2.0"
|
|
70
|
+
"picocolors": "^1.0.0",
|
|
71
|
+
"semver": "^7.5.4"
|
|
63
72
|
},
|
|
64
73
|
"scripts": {
|
|
65
74
|
"preinstall": "npx only-allow pnpm",
|
|
66
75
|
"dev": "tsup --watch",
|
|
67
76
|
"build": "tsup",
|
|
68
77
|
"release": "pnpm build && node bin/index.js release",
|
|
69
|
-
"lint": "eslint --ext .ts,.js"
|
|
78
|
+
"lint": "eslint --ext .ts,.js",
|
|
79
|
+
"commit-lint": "node bin/index.js commit-lint"
|
|
70
80
|
}
|
|
71
81
|
}
|