@varlet/release 0.2.0 → 0.2.1
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 +153 -151
- package/README.zh-CN.md +153 -151
- package/bin/index.js +36 -35
- package/dist/index.cjs +5 -3
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -3
- package/package.json +1 -1
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,151 +1,153 @@
|
|
|
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 https://github.com/varletjs/varlet-release
|
|
46
|
-
# or
|
|
47
|
-
npx vr release --remote https://github.com/varletjs/varlet-release
|
|
48
|
-
|
|
49
|
-
# Just generate changelogs
|
|
50
|
-
npx vr changelog
|
|
51
|
-
|
|
52
|
-
# Specify changelog filename
|
|
53
|
-
npx vr changelog -f changelog.md
|
|
54
|
-
# or
|
|
55
|
-
npx vr changelog --file changelog.md
|
|
56
|
-
|
|
57
|
-
# Lint commit message
|
|
58
|
-
npx vr lint-commit -p .git/COMMIT_EDITMSG
|
|
59
|
-
|
|
60
|
-
# Publish to npm, which can be called in the ci environment
|
|
61
|
-
npx vr publish
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Configuration
|
|
65
|
-
|
|
66
|
-
#### release
|
|
67
|
-
|
|
68
|
-
| Params | Instructions |
|
|
69
|
-
| ---------------------- | ------------------- |
|
|
70
|
-
| -r --remote \<remote\> | Specify remote name |
|
|
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
|
-
await
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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 https://github.com/varletjs/varlet-release
|
|
46
|
+
# or
|
|
47
|
+
npx vr release --remote https://github.com/varletjs/varlet-release
|
|
48
|
+
|
|
49
|
+
# Just generate changelogs
|
|
50
|
+
npx vr changelog
|
|
51
|
+
|
|
52
|
+
# Specify changelog filename
|
|
53
|
+
npx vr changelog -f changelog.md
|
|
54
|
+
# or
|
|
55
|
+
npx vr changelog --file changelog.md
|
|
56
|
+
|
|
57
|
+
# Lint commit message
|
|
58
|
+
npx vr lint-commit -p .git/COMMIT_EDITMSG
|
|
59
|
+
|
|
60
|
+
# Publish to npm, which can be called in the ci environment
|
|
61
|
+
npx vr publish
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Configuration
|
|
65
|
+
|
|
66
|
+
#### release
|
|
67
|
+
|
|
68
|
+
| Params | Instructions |
|
|
69
|
+
| ---------------------- | ------------------- |
|
|
70
|
+
| -r --remote \<remote\> | Specify remote name |
|
|
71
|
+
| -s --skip-npm-publish | Skip npm publish |
|
|
72
|
+
| -sgt --skip-git-tag | Skip git tag |
|
|
73
|
+
|
|
74
|
+
#### changelog
|
|
75
|
+
|
|
76
|
+
| Params | Instructions |
|
|
77
|
+
| ----------------------------------- | -------------------------- |
|
|
78
|
+
| -f --file \<filename\> | Specify changelog filename |
|
|
79
|
+
| -rc --releaseCount \<releaseCount\> | Release count |
|
|
80
|
+
|
|
81
|
+
#### lint-commit
|
|
82
|
+
|
|
83
|
+
| Params | Instructions |
|
|
84
|
+
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
85
|
+
| -p --commitMessagePath \<path\> | The path of the temporary file to which the git message is submitted. The git hook commit-msg will pass this parameter |
|
|
86
|
+
| -r --commitMessageRe \<reg\> | Validate the regular of whether the commit message passes |
|
|
87
|
+
| -e --errorMessage \<message\> | Validation failed to display error messages |
|
|
88
|
+
| -w --warningMessage \<message\> | Validation failed to display warning messages |
|
|
89
|
+
|
|
90
|
+
#### publish
|
|
91
|
+
|
|
92
|
+
```shell
|
|
93
|
+
vr publish
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Custom Handle
|
|
97
|
+
|
|
98
|
+
#### Example
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
import { release, changelog } from '@varlet/release'
|
|
102
|
+
|
|
103
|
+
// Do what you want to do...
|
|
104
|
+
release()
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
You can pass in a task that will be called before the publish after the package version is changed.
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
import { release, changelog } from '@varlet/release'
|
|
111
|
+
|
|
112
|
+
async function task() {
|
|
113
|
+
await doSomething1()
|
|
114
|
+
await doSomething2()
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
release({ task })
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### Types
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
function publish(preRelease: boolean | undefined): Promise<void>
|
|
124
|
+
function updateVersion(version: string): void
|
|
125
|
+
interface ReleaseCommandOptions {
|
|
126
|
+
remote?: string
|
|
127
|
+
skipNpmPublish?: boolean
|
|
128
|
+
skipGitTag?: boolean
|
|
129
|
+
task?(): Promise<void>
|
|
130
|
+
}
|
|
131
|
+
function release(options: ReleaseCommandOptions): Promise<void>
|
|
132
|
+
|
|
133
|
+
interface ChangelogCommandOptions {
|
|
134
|
+
file?: string
|
|
135
|
+
releaseCount?: number
|
|
136
|
+
}
|
|
137
|
+
function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
|
|
138
|
+
|
|
139
|
+
const COMMIT_MESSAGE_RE: RegExp
|
|
140
|
+
function isVersionCommitMessage(message: string): string | false | null
|
|
141
|
+
function getCommitMessage(commitMessagePath: string): string
|
|
142
|
+
interface CommitLintCommandOptions {
|
|
143
|
+
commitMessagePath: string
|
|
144
|
+
commitMessageRe?: string | RegExp
|
|
145
|
+
errorMessage?: string
|
|
146
|
+
warningMessage?: string
|
|
147
|
+
}
|
|
148
|
+
function commitLint(options: CommitLintCommandOptions): void
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
[MIT](https://github.com/varletjs/release/blob/main/LICENCE)
|
package/README.zh-CN.md
CHANGED
|
@@ -1,151 +1,153 @@
|
|
|
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 https://github.com/varletjs/varlet-release
|
|
46
|
-
# or
|
|
47
|
-
npx vr release --remote https://github.com/varletjs/varlet-release
|
|
48
|
-
|
|
49
|
-
# 仅生成变更日志
|
|
50
|
-
npx vr changelog
|
|
51
|
-
|
|
52
|
-
# 指定变更日志文件名
|
|
53
|
-
npx vr changelog -f changelog.md
|
|
54
|
-
# or
|
|
55
|
-
npx vr changelog --file changelog.md
|
|
56
|
-
|
|
57
|
-
# 检测 commit message
|
|
58
|
-
npx vr lint-commit -p .git/COMMIT_EDITMSG
|
|
59
|
-
|
|
60
|
-
# 发布到 npm,可以在 ci 中执行
|
|
61
|
-
npx vr publish
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### 配置
|
|
65
|
-
|
|
66
|
-
#### release
|
|
67
|
-
|
|
68
|
-
| 参数 | 说明 |
|
|
69
|
-
| ---------------------- | ---------------- |
|
|
70
|
-
| -r --remote \<remote\> | 指定远程仓库名称 |
|
|
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
|
-
await
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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 https://github.com/varletjs/varlet-release
|
|
46
|
+
# or
|
|
47
|
+
npx vr release --remote https://github.com/varletjs/varlet-release
|
|
48
|
+
|
|
49
|
+
# 仅生成变更日志
|
|
50
|
+
npx vr changelog
|
|
51
|
+
|
|
52
|
+
# 指定变更日志文件名
|
|
53
|
+
npx vr changelog -f changelog.md
|
|
54
|
+
# or
|
|
55
|
+
npx vr changelog --file changelog.md
|
|
56
|
+
|
|
57
|
+
# 检测 commit message
|
|
58
|
+
npx vr lint-commit -p .git/COMMIT_EDITMSG
|
|
59
|
+
|
|
60
|
+
# 发布到 npm,可以在 ci 中执行
|
|
61
|
+
npx vr publish
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 配置
|
|
65
|
+
|
|
66
|
+
#### release
|
|
67
|
+
|
|
68
|
+
| 参数 | 说明 |
|
|
69
|
+
| ---------------------- | ---------------- |
|
|
70
|
+
| -r --remote \<remote\> | 指定远程仓库名称 |
|
|
71
|
+
| -s --skip-npm-publish | 跳过 npm 发布 |
|
|
72
|
+
| -sgt --skip-git-tag | 跳过 git tag |
|
|
73
|
+
|
|
74
|
+
#### changelog
|
|
75
|
+
|
|
76
|
+
| 参数 | 说明 |
|
|
77
|
+
| ----------------------------------- | ------------------ |
|
|
78
|
+
| -f --file \<filename\> | 指定变更日志文件名 |
|
|
79
|
+
| -rc --releaseCount \<releaseCount\> | 发布数量 |
|
|
80
|
+
|
|
81
|
+
#### lint-commit
|
|
82
|
+
|
|
83
|
+
| 参数 | 说明 |
|
|
84
|
+
| ------------------------------- | --------------------------------------------------------------------------- |
|
|
85
|
+
| -p --commitMessagePath \<path\> | 提交 `git message` 的临时文件路径。`git` 钩子 `commit-msg` 会传递这个参数。 |
|
|
86
|
+
| -r --commitMessageRe \<reg\> | 验证 `commit message` 是否通过的正则 |
|
|
87
|
+
| -e --errorMessage \<message\> | 验证失败展示的错误信息 |
|
|
88
|
+
| -w --warningMessage \<message\> | 验证失败展示的提示信息 |
|
|
89
|
+
|
|
90
|
+
#### publish
|
|
91
|
+
|
|
92
|
+
```shell
|
|
93
|
+
vr publish
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 自定义处理
|
|
97
|
+
|
|
98
|
+
#### 示例
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
import { release, changelog } from '@varlet/release'
|
|
102
|
+
|
|
103
|
+
// Do what you want to do...
|
|
104
|
+
release()
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
你可以传入一个 `task`,在包版本更改后,在发布之前会调用 `task`。
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
import { release, changelog } from '@varlet/release'
|
|
111
|
+
|
|
112
|
+
async function task() {
|
|
113
|
+
await doSomething1()
|
|
114
|
+
await doSomething2()
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
release({ task })
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### 类型
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
function publish(preRelease: boolean | undefined): Promise<void>
|
|
124
|
+
function updateVersion(version: string): void
|
|
125
|
+
interface ReleaseCommandOptions {
|
|
126
|
+
remote?: string
|
|
127
|
+
skipNpmPublish?: boolean
|
|
128
|
+
skipGitTag?: boolean
|
|
129
|
+
task?(): Promise<void>
|
|
130
|
+
}
|
|
131
|
+
function release(options: ReleaseCommandOptions): Promise<void>
|
|
132
|
+
|
|
133
|
+
interface ChangelogCommandOptions {
|
|
134
|
+
file?: string
|
|
135
|
+
releaseCount?: number
|
|
136
|
+
}
|
|
137
|
+
function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
|
|
138
|
+
|
|
139
|
+
const COMMIT_MESSAGE_RE: RegExp
|
|
140
|
+
function isVersionCommitMessage(message: string): string | false | null
|
|
141
|
+
function getCommitMessage(commitMessagePath: string): string
|
|
142
|
+
interface CommitLintCommandOptions {
|
|
143
|
+
commitMessagePath: string
|
|
144
|
+
commitMessageRe?: string | RegExp
|
|
145
|
+
errorMessage?: string
|
|
146
|
+
warningMessage?: string
|
|
147
|
+
}
|
|
148
|
+
function commitLint(options: CommitLintCommandOptions): void
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
[MIT](https://github.com/varletjs/release/blob/main/LICENSE)
|
package/bin/index.js
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { release, publish, changelog, commitLint } from '../dist/index.js'
|
|
3
|
-
import { Command } from 'commander'
|
|
4
|
-
|
|
5
|
-
const program = new Command()
|
|
6
|
-
|
|
7
|
-
program
|
|
8
|
-
.command('release')
|
|
9
|
-
.option('-r --remote <remote>', 'Remote name')
|
|
10
|
-
.option('-s --skip-npm-publish', 'Skip npm publish')
|
|
11
|
-
.
|
|
12
|
-
.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
.
|
|
22
|
-
.option('-
|
|
23
|
-
.
|
|
24
|
-
.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.
|
|
29
|
-
.option('-
|
|
30
|
-
.option('-
|
|
31
|
-
.option('-
|
|
32
|
-
.
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { release, publish, changelog, commitLint } from '../dist/index.js'
|
|
3
|
+
import { Command } from 'commander'
|
|
4
|
+
|
|
5
|
+
const program = new Command()
|
|
6
|
+
|
|
7
|
+
program
|
|
8
|
+
.command('release')
|
|
9
|
+
.option('-r --remote <remote>', 'Remote name')
|
|
10
|
+
.option('-s --skip-npm-publish', 'Skip npm publish')
|
|
11
|
+
.option('-sgt --skip-git-tag', 'Skip git tag')
|
|
12
|
+
.description('Release all packages and generate changelogs')
|
|
13
|
+
.action(async (options) => release(options))
|
|
14
|
+
|
|
15
|
+
program
|
|
16
|
+
.command('publish')
|
|
17
|
+
.description('Publish to npm')
|
|
18
|
+
.action(async () => publish())
|
|
19
|
+
|
|
20
|
+
program
|
|
21
|
+
.command('changelog')
|
|
22
|
+
.option('-rc --releaseCount <releaseCount>', 'Release count')
|
|
23
|
+
.option('-f --file <file>', 'Changelog filename')
|
|
24
|
+
.description('Generate changelog')
|
|
25
|
+
.action(async (options) => changelog(options))
|
|
26
|
+
|
|
27
|
+
program
|
|
28
|
+
.command('commit-lint')
|
|
29
|
+
.option('-p --commitMessagePath <path>', 'Git commit message path')
|
|
30
|
+
.option('-r --commitMessageRe <reg>', 'Validate the regular of whether the commit message passes')
|
|
31
|
+
.option('-e --errorMessage <message>', 'Validation failed to display error messages')
|
|
32
|
+
.option('-w --warningMessage <message>', 'Validation failed to display warning messages')
|
|
33
|
+
.description('Lint commit message')
|
|
34
|
+
.action(async (option) => commitLint(option))
|
|
35
|
+
|
|
36
|
+
program.parse()
|
package/dist/index.cjs
CHANGED
|
@@ -114,11 +114,13 @@ async function publish(preRelease) {
|
|
|
114
114
|
ret.stdout && logger_default.info(ret.stdout);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
async function pushGit(version, remote = "origin") {
|
|
117
|
+
async function pushGit(version, remote = "origin", skipGitTag = false) {
|
|
118
118
|
const s = (0, import_nanospinner2.createSpinner)("Pushing to remote git repository").start();
|
|
119
119
|
await (0, import_execa.execa)("git", ["add", "."]);
|
|
120
120
|
await (0, import_execa.execa)("git", ["commit", "-m", `v${version}`]);
|
|
121
|
-
|
|
121
|
+
if (!skipGitTag) {
|
|
122
|
+
await (0, import_execa.execa)("git", ["tag", `v${version}`]);
|
|
123
|
+
}
|
|
122
124
|
await (0, import_execa.execa)("git", ["push", remote, `v${version}`]);
|
|
123
125
|
const ret = await (0, import_execa.execa)("git", ["push"]);
|
|
124
126
|
s.success({ text: "Push remote repository successfully" });
|
|
@@ -216,7 +218,7 @@ async function release(options) {
|
|
|
216
218
|
}
|
|
217
219
|
if (!isPreRelease) {
|
|
218
220
|
await changelog();
|
|
219
|
-
await pushGit(expectVersion, options.remote);
|
|
221
|
+
await pushGit(expectVersion, options.remote, options.skipGitTag);
|
|
220
222
|
}
|
|
221
223
|
logger_default.success(`Release version ${expectVersion} successfully!`);
|
|
222
224
|
if (isPreRelease) {
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -71,11 +71,13 @@ async function publish(preRelease) {
|
|
|
71
71
|
ret.stdout && logger_default.info(ret.stdout);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
async function pushGit(version, remote = "origin") {
|
|
74
|
+
async function pushGit(version, remote = "origin", skipGitTag = false) {
|
|
75
75
|
const s = createSpinner2("Pushing to remote git repository").start();
|
|
76
76
|
await execa("git", ["add", "."]);
|
|
77
77
|
await execa("git", ["commit", "-m", `v${version}`]);
|
|
78
|
-
|
|
78
|
+
if (!skipGitTag) {
|
|
79
|
+
await execa("git", ["tag", `v${version}`]);
|
|
80
|
+
}
|
|
79
81
|
await execa("git", ["push", remote, `v${version}`]);
|
|
80
82
|
const ret = await execa("git", ["push"]);
|
|
81
83
|
s.success({ text: "Push remote repository successfully" });
|
|
@@ -173,7 +175,7 @@ async function release(options) {
|
|
|
173
175
|
}
|
|
174
176
|
if (!isPreRelease) {
|
|
175
177
|
await changelog();
|
|
176
|
-
await pushGit(expectVersion, options.remote);
|
|
178
|
+
await pushGit(expectVersion, options.remote, options.skipGitTag);
|
|
177
179
|
}
|
|
178
180
|
logger_default.success(`Release version ${expectVersion} successfully!`);
|
|
179
181
|
if (isPreRelease) {
|