@varlet/release 0.2.10 → 0.2.11
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 +150 -150
- package/README.zh-CN.md +150 -150
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,150 +1,150 @@
|
|
|
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 used for publishing all packages, generating change logs, and checking `commit messages`, relying on `pnpm`.
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
```shell
|
|
19
|
-
pnpm add @varlet/release -D
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Usage
|
|
23
|
-
|
|
24
|
-
### Using Command
|
|
25
|
-
|
|
26
|
-
```shell
|
|
27
|
-
# Release all packages and generate changelogs
|
|
28
|
-
npx vr release
|
|
29
|
-
|
|
30
|
-
# Specify remote name
|
|
31
|
-
npx vr release -r https://github.com/varletjs/varlet-release
|
|
32
|
-
# or
|
|
33
|
-
npx vr release --remote https://github.com/varletjs/varlet-release
|
|
34
|
-
|
|
35
|
-
# Just generate changelogs
|
|
36
|
-
npx vr changelog
|
|
37
|
-
|
|
38
|
-
# Specify changelog filename
|
|
39
|
-
npx vr changelog -f changelog.md
|
|
40
|
-
# or
|
|
41
|
-
npx vr changelog --file changelog.md
|
|
42
|
-
|
|
43
|
-
# Lint commit message
|
|
44
|
-
npx vr lint-commit -p .git/COMMIT_EDITMSG
|
|
45
|
-
|
|
46
|
-
# Publish to npm, which can be called in the ci environment
|
|
47
|
-
npx vr publish
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Configuration
|
|
51
|
-
|
|
52
|
-
#### release
|
|
53
|
-
|
|
54
|
-
| Params | Instructions |
|
|
55
|
-
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
56
|
-
| -r --remote \<remote\> | Specify remote name |
|
|
57
|
-
| -s --skip-npm-publish | Skip npm publish |
|
|
58
|
-
| -c --check-remote-version | Check if the remote version of the npm package is the same as the one you want to publish locally, if so, stop execution. |
|
|
59
|
-
| -sc --skip-changelog | Skip generate changelog |
|
|
60
|
-
| -sgt --skip-git-tag | Skip git tag |
|
|
61
|
-
| -nt --npm-tag \<npmTag\> | npm tag |
|
|
62
|
-
|
|
63
|
-
#### changelog
|
|
64
|
-
|
|
65
|
-
| Params | Instructions |
|
|
66
|
-
| ----------------------------------- | -------------------------- |
|
|
67
|
-
| -f --file \<filename\> | Specify changelog filename |
|
|
68
|
-
| -rc --releaseCount \<releaseCount\> | Release count |
|
|
69
|
-
|
|
70
|
-
#### lint-commit
|
|
71
|
-
|
|
72
|
-
| Params | Instructions |
|
|
73
|
-
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
74
|
-
| -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 |
|
|
75
|
-
| -r --commitMessageRe \<reg\> | Validate the regular of whether the commit message passes |
|
|
76
|
-
| -e --errorMessage \<message\> | Validation failed to display error messages |
|
|
77
|
-
| -w --warningMessage \<message\> | Validation failed to display warning messages |
|
|
78
|
-
|
|
79
|
-
#### publish
|
|
80
|
-
|
|
81
|
-
| Params | Instructions |
|
|
82
|
-
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
83
|
-
| -c --check-remote-version | Detects whether the remote version of the npm package is the same as the package version to be published locally, and if it is, skip the release |
|
|
84
|
-
| -nt --npm-tag \<npmTag\> | npm tag |
|
|
85
|
-
|
|
86
|
-
### Custom Handle
|
|
87
|
-
|
|
88
|
-
#### Example
|
|
89
|
-
|
|
90
|
-
```js
|
|
91
|
-
import { release, changelog } from '@varlet/release'
|
|
92
|
-
|
|
93
|
-
// Do what you want to do...
|
|
94
|
-
release()
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
You can pass in a task that will be called before the publish after the package version is changed.
|
|
98
|
-
|
|
99
|
-
```js
|
|
100
|
-
import { release, changelog } from '@varlet/release'
|
|
101
|
-
|
|
102
|
-
async function task() {
|
|
103
|
-
await doSomething1()
|
|
104
|
-
await doSomething2()
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
release({ task })
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
#### Types
|
|
111
|
-
|
|
112
|
-
```ts
|
|
113
|
-
interface PublishCommandOptions {
|
|
114
|
-
preRelease?: boolean
|
|
115
|
-
checkRemoteVersion?: boolean
|
|
116
|
-
npmTag?: string
|
|
117
|
-
}
|
|
118
|
-
function publish({ preRelease, checkRemoteVersion, npmTag }: PublishCommandOptions): Promise<void>
|
|
119
|
-
function updateVersion(version: string): void
|
|
120
|
-
interface ReleaseCommandOptions {
|
|
121
|
-
remote?: string
|
|
122
|
-
skipNpmPublish?: boolean
|
|
123
|
-
skipChangelog?: boolean
|
|
124
|
-
skipGitTag?: boolean
|
|
125
|
-
npmTag?: string
|
|
126
|
-
task?(): Promise<void>
|
|
127
|
-
}
|
|
128
|
-
function release(options: ReleaseCommandOptions): Promise<void>
|
|
129
|
-
|
|
130
|
-
interface ChangelogCommandOptions {
|
|
131
|
-
file?: string
|
|
132
|
-
releaseCount?: number
|
|
133
|
-
}
|
|
134
|
-
function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
|
|
135
|
-
|
|
136
|
-
const COMMIT_MESSAGE_RE: RegExp
|
|
137
|
-
function isVersionCommitMessage(message: string): string | false | null
|
|
138
|
-
function getCommitMessage(commitMessagePath: string): string
|
|
139
|
-
interface CommitLintCommandOptions {
|
|
140
|
-
commitMessagePath: string
|
|
141
|
-
commitMessageRe?: string | RegExp
|
|
142
|
-
errorMessage?: string
|
|
143
|
-
warningMessage?: string
|
|
144
|
-
}
|
|
145
|
-
function commitLint(options: CommitLintCommandOptions): void
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
## License
|
|
149
|
-
|
|
150
|
-
[MIT](https://github.com/varletjs/release/blob/main/LICENCE)
|
|
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 used for publishing all packages, generating change logs, and checking `commit messages`, relying on `pnpm`.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```shell
|
|
19
|
+
pnpm add @varlet/release -D
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### Using Command
|
|
25
|
+
|
|
26
|
+
```shell
|
|
27
|
+
# Release all packages and generate changelogs
|
|
28
|
+
npx vr release
|
|
29
|
+
|
|
30
|
+
# Specify remote name
|
|
31
|
+
npx vr release -r https://github.com/varletjs/varlet-release
|
|
32
|
+
# or
|
|
33
|
+
npx vr release --remote https://github.com/varletjs/varlet-release
|
|
34
|
+
|
|
35
|
+
# Just generate changelogs
|
|
36
|
+
npx vr changelog
|
|
37
|
+
|
|
38
|
+
# Specify changelog filename
|
|
39
|
+
npx vr changelog -f changelog.md
|
|
40
|
+
# or
|
|
41
|
+
npx vr changelog --file changelog.md
|
|
42
|
+
|
|
43
|
+
# Lint commit message
|
|
44
|
+
npx vr lint-commit -p .git/COMMIT_EDITMSG
|
|
45
|
+
|
|
46
|
+
# Publish to npm, which can be called in the ci environment
|
|
47
|
+
npx vr publish
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Configuration
|
|
51
|
+
|
|
52
|
+
#### release
|
|
53
|
+
|
|
54
|
+
| Params | Instructions |
|
|
55
|
+
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
56
|
+
| -r --remote \<remote\> | Specify remote name |
|
|
57
|
+
| -s --skip-npm-publish | Skip npm publish |
|
|
58
|
+
| -c --check-remote-version | Check if the remote version of the npm package is the same as the one you want to publish locally, if so, stop execution. |
|
|
59
|
+
| -sc --skip-changelog | Skip generate changelog |
|
|
60
|
+
| -sgt --skip-git-tag | Skip git tag |
|
|
61
|
+
| -nt --npm-tag \<npmTag\> | npm tag |
|
|
62
|
+
|
|
63
|
+
#### changelog
|
|
64
|
+
|
|
65
|
+
| Params | Instructions |
|
|
66
|
+
| ----------------------------------- | -------------------------- |
|
|
67
|
+
| -f --file \<filename\> | Specify changelog filename |
|
|
68
|
+
| -rc --releaseCount \<releaseCount\> | Release count |
|
|
69
|
+
|
|
70
|
+
#### lint-commit
|
|
71
|
+
|
|
72
|
+
| Params | Instructions |
|
|
73
|
+
| ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
74
|
+
| -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 |
|
|
75
|
+
| -r --commitMessageRe \<reg\> | Validate the regular of whether the commit message passes |
|
|
76
|
+
| -e --errorMessage \<message\> | Validation failed to display error messages |
|
|
77
|
+
| -w --warningMessage \<message\> | Validation failed to display warning messages |
|
|
78
|
+
|
|
79
|
+
#### publish
|
|
80
|
+
|
|
81
|
+
| Params | Instructions |
|
|
82
|
+
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
83
|
+
| -c --check-remote-version | Detects whether the remote version of the npm package is the same as the package version to be published locally, and if it is, skip the release |
|
|
84
|
+
| -nt --npm-tag \<npmTag\> | npm tag |
|
|
85
|
+
|
|
86
|
+
### Custom Handle
|
|
87
|
+
|
|
88
|
+
#### Example
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
import { release, changelog } from '@varlet/release'
|
|
92
|
+
|
|
93
|
+
// Do what you want to do...
|
|
94
|
+
release()
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
You can pass in a task that will be called before the publish after the package version is changed.
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
import { release, changelog } from '@varlet/release'
|
|
101
|
+
|
|
102
|
+
async function task() {
|
|
103
|
+
await doSomething1()
|
|
104
|
+
await doSomething2()
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
release({ task })
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### Types
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
interface PublishCommandOptions {
|
|
114
|
+
preRelease?: boolean
|
|
115
|
+
checkRemoteVersion?: boolean
|
|
116
|
+
npmTag?: string
|
|
117
|
+
}
|
|
118
|
+
function publish({ preRelease, checkRemoteVersion, npmTag }: PublishCommandOptions): Promise<void>
|
|
119
|
+
function updateVersion(version: string): void
|
|
120
|
+
interface ReleaseCommandOptions {
|
|
121
|
+
remote?: string
|
|
122
|
+
skipNpmPublish?: boolean
|
|
123
|
+
skipChangelog?: boolean
|
|
124
|
+
skipGitTag?: boolean
|
|
125
|
+
npmTag?: string
|
|
126
|
+
task?(newVersion: string, oldVersion: string): Promise<void>
|
|
127
|
+
}
|
|
128
|
+
function release(options: ReleaseCommandOptions): Promise<void>
|
|
129
|
+
|
|
130
|
+
interface ChangelogCommandOptions {
|
|
131
|
+
file?: string
|
|
132
|
+
releaseCount?: number
|
|
133
|
+
}
|
|
134
|
+
function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
|
|
135
|
+
|
|
136
|
+
const COMMIT_MESSAGE_RE: RegExp
|
|
137
|
+
function isVersionCommitMessage(message: string): string | false | null
|
|
138
|
+
function getCommitMessage(commitMessagePath: string): string
|
|
139
|
+
interface CommitLintCommandOptions {
|
|
140
|
+
commitMessagePath: string
|
|
141
|
+
commitMessageRe?: string | RegExp
|
|
142
|
+
errorMessage?: string
|
|
143
|
+
warningMessage?: string
|
|
144
|
+
}
|
|
145
|
+
function commitLint(options: CommitLintCommandOptions): void
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
[MIT](https://github.com/varletjs/release/blob/main/LICENCE)
|
package/README.zh-CN.md
CHANGED
|
@@ -1,150 +1,150 @@
|
|
|
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` 的工具,依赖于 `pnpm`。
|
|
15
|
-
|
|
16
|
-
## 安装
|
|
17
|
-
|
|
18
|
-
```shell
|
|
19
|
-
pnpm add @varlet/release -D
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## 使用
|
|
23
|
-
|
|
24
|
-
### 使用命令
|
|
25
|
-
|
|
26
|
-
```shell
|
|
27
|
-
# 发布所有包并生成变更日志
|
|
28
|
-
npx vr release
|
|
29
|
-
|
|
30
|
-
# 指定远程仓库名称
|
|
31
|
-
npx vr release -r https://github.com/varletjs/varlet-release
|
|
32
|
-
# or
|
|
33
|
-
npx vr release --remote https://github.com/varletjs/varlet-release
|
|
34
|
-
|
|
35
|
-
# 仅生成变更日志
|
|
36
|
-
npx vr changelog
|
|
37
|
-
|
|
38
|
-
# 指定变更日志文件名
|
|
39
|
-
npx vr changelog -f changelog.md
|
|
40
|
-
# or
|
|
41
|
-
npx vr changelog --file changelog.md
|
|
42
|
-
|
|
43
|
-
# 检测 commit message
|
|
44
|
-
npx vr lint-commit -p .git/COMMIT_EDITMSG
|
|
45
|
-
|
|
46
|
-
# 发布到 npm,可以在 ci 中执行
|
|
47
|
-
npx vr publish
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### 配置
|
|
51
|
-
|
|
52
|
-
#### release
|
|
53
|
-
|
|
54
|
-
| 参数 | 说明 |
|
|
55
|
-
| ------------------------- | ----------------------------------------------------------------------- |
|
|
56
|
-
| -r --remote \<remote\> | 指定远程仓库名称 |
|
|
57
|
-
| -s --skip-npm-publish | 跳过 npm 发布 |
|
|
58
|
-
| -c --check-remote-version | 检测 npm 包的远程版本是否与要在本地发布的包版本相同,如果是,则停止执行 |
|
|
59
|
-
| -sc --skip-changelog | 跳过生成变更日志 |
|
|
60
|
-
| -sgt --skip-git-tag | 跳过 git tag |
|
|
61
|
-
| -nt --npm-tag \<npmTag\> | npm tag |
|
|
62
|
-
|
|
63
|
-
#### changelog
|
|
64
|
-
|
|
65
|
-
| 参数 | 说明 |
|
|
66
|
-
| ----------------------------------- | ------------------ |
|
|
67
|
-
| -f --file \<filename\> | 指定变更日志文件名 |
|
|
68
|
-
| -rc --releaseCount \<releaseCount\> | 发布数量 |
|
|
69
|
-
|
|
70
|
-
#### lint-commit
|
|
71
|
-
|
|
72
|
-
| 参数 | 说明 |
|
|
73
|
-
| ------------------------------- | --------------------------------------------------------------------------- |
|
|
74
|
-
| -p --commitMessagePath \<path\> | 提交 `git message` 的临时文件路径。`git` 钩子 `commit-msg` 会传递这个参数。 |
|
|
75
|
-
| -r --commitMessageRe \<reg\> | 验证 `commit message` 是否通过的正则 |
|
|
76
|
-
| -e --errorMessage \<message\> | 验证失败展示的错误信息 |
|
|
77
|
-
| -w --warningMessage \<message\> | 验证失败展示的提示信息 |
|
|
78
|
-
|
|
79
|
-
#### publish
|
|
80
|
-
|
|
81
|
-
| 参数 | 说明 |
|
|
82
|
-
| ------------------------- | --------------------------------------------------------------------- |
|
|
83
|
-
| -c --check-remote-version | 检测npm包的远程版本是否与要在本地发布的包版本相同,如果是,则跳过发布 |
|
|
84
|
-
| -nt --npm-tag \<npmTag\> | npm tag |
|
|
85
|
-
|
|
86
|
-
### 自定义处理
|
|
87
|
-
|
|
88
|
-
#### 示例
|
|
89
|
-
|
|
90
|
-
```js
|
|
91
|
-
import { release, changelog } from '@varlet/release'
|
|
92
|
-
|
|
93
|
-
// Do what you want to do...
|
|
94
|
-
release()
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
你可以传入一个 `task`,在包版本更改后,在发布之前会调用 `task`。
|
|
98
|
-
|
|
99
|
-
```js
|
|
100
|
-
import { release, changelog } from '@varlet/release'
|
|
101
|
-
|
|
102
|
-
async function task() {
|
|
103
|
-
await doSomething1()
|
|
104
|
-
await doSomething2()
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
release({ task })
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
#### 类型
|
|
111
|
-
|
|
112
|
-
```ts
|
|
113
|
-
interface PublishCommandOptions {
|
|
114
|
-
preRelease?: boolean
|
|
115
|
-
checkRemoteVersion?: boolean
|
|
116
|
-
npmTag?: string
|
|
117
|
-
}
|
|
118
|
-
function publish({ preRelease, checkRemoteVersion, npmTag }: PublishCommandOptions): Promise<void>
|
|
119
|
-
function updateVersion(version: string): void
|
|
120
|
-
interface ReleaseCommandOptions {
|
|
121
|
-
remote?: string
|
|
122
|
-
skipNpmPublish?: boolean
|
|
123
|
-
skipChangelog?: boolean
|
|
124
|
-
skipGitTag?: boolean
|
|
125
|
-
npmTag?: string
|
|
126
|
-
task?(): Promise<void>
|
|
127
|
-
}
|
|
128
|
-
function release(options: ReleaseCommandOptions): Promise<void>
|
|
129
|
-
|
|
130
|
-
interface ChangelogCommandOptions {
|
|
131
|
-
file?: string
|
|
132
|
-
releaseCount?: number
|
|
133
|
-
}
|
|
134
|
-
function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
|
|
135
|
-
|
|
136
|
-
const COMMIT_MESSAGE_RE: RegExp
|
|
137
|
-
function isVersionCommitMessage(message: string): string | false | null
|
|
138
|
-
function getCommitMessage(commitMessagePath: string): string
|
|
139
|
-
interface CommitLintCommandOptions {
|
|
140
|
-
commitMessagePath: string
|
|
141
|
-
commitMessageRe?: string | RegExp
|
|
142
|
-
errorMessage?: string
|
|
143
|
-
warningMessage?: string
|
|
144
|
-
}
|
|
145
|
-
function commitLint(options: CommitLintCommandOptions): void
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
## License
|
|
149
|
-
|
|
150
|
-
[MIT](https://github.com/varletjs/release/blob/main/LICENSE)
|
|
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` 的工具,依赖于 `pnpm`。
|
|
15
|
+
|
|
16
|
+
## 安装
|
|
17
|
+
|
|
18
|
+
```shell
|
|
19
|
+
pnpm add @varlet/release -D
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 使用
|
|
23
|
+
|
|
24
|
+
### 使用命令
|
|
25
|
+
|
|
26
|
+
```shell
|
|
27
|
+
# 发布所有包并生成变更日志
|
|
28
|
+
npx vr release
|
|
29
|
+
|
|
30
|
+
# 指定远程仓库名称
|
|
31
|
+
npx vr release -r https://github.com/varletjs/varlet-release
|
|
32
|
+
# or
|
|
33
|
+
npx vr release --remote https://github.com/varletjs/varlet-release
|
|
34
|
+
|
|
35
|
+
# 仅生成变更日志
|
|
36
|
+
npx vr changelog
|
|
37
|
+
|
|
38
|
+
# 指定变更日志文件名
|
|
39
|
+
npx vr changelog -f changelog.md
|
|
40
|
+
# or
|
|
41
|
+
npx vr changelog --file changelog.md
|
|
42
|
+
|
|
43
|
+
# 检测 commit message
|
|
44
|
+
npx vr lint-commit -p .git/COMMIT_EDITMSG
|
|
45
|
+
|
|
46
|
+
# 发布到 npm,可以在 ci 中执行
|
|
47
|
+
npx vr publish
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 配置
|
|
51
|
+
|
|
52
|
+
#### release
|
|
53
|
+
|
|
54
|
+
| 参数 | 说明 |
|
|
55
|
+
| ------------------------- | ----------------------------------------------------------------------- |
|
|
56
|
+
| -r --remote \<remote\> | 指定远程仓库名称 |
|
|
57
|
+
| -s --skip-npm-publish | 跳过 npm 发布 |
|
|
58
|
+
| -c --check-remote-version | 检测 npm 包的远程版本是否与要在本地发布的包版本相同,如果是,则停止执行 |
|
|
59
|
+
| -sc --skip-changelog | 跳过生成变更日志 |
|
|
60
|
+
| -sgt --skip-git-tag | 跳过 git tag |
|
|
61
|
+
| -nt --npm-tag \<npmTag\> | npm tag |
|
|
62
|
+
|
|
63
|
+
#### changelog
|
|
64
|
+
|
|
65
|
+
| 参数 | 说明 |
|
|
66
|
+
| ----------------------------------- | ------------------ |
|
|
67
|
+
| -f --file \<filename\> | 指定变更日志文件名 |
|
|
68
|
+
| -rc --releaseCount \<releaseCount\> | 发布数量 |
|
|
69
|
+
|
|
70
|
+
#### lint-commit
|
|
71
|
+
|
|
72
|
+
| 参数 | 说明 |
|
|
73
|
+
| ------------------------------- | --------------------------------------------------------------------------- |
|
|
74
|
+
| -p --commitMessagePath \<path\> | 提交 `git message` 的临时文件路径。`git` 钩子 `commit-msg` 会传递这个参数。 |
|
|
75
|
+
| -r --commitMessageRe \<reg\> | 验证 `commit message` 是否通过的正则 |
|
|
76
|
+
| -e --errorMessage \<message\> | 验证失败展示的错误信息 |
|
|
77
|
+
| -w --warningMessage \<message\> | 验证失败展示的提示信息 |
|
|
78
|
+
|
|
79
|
+
#### publish
|
|
80
|
+
|
|
81
|
+
| 参数 | 说明 |
|
|
82
|
+
| ------------------------- | --------------------------------------------------------------------- |
|
|
83
|
+
| -c --check-remote-version | 检测npm包的远程版本是否与要在本地发布的包版本相同,如果是,则跳过发布 |
|
|
84
|
+
| -nt --npm-tag \<npmTag\> | npm tag |
|
|
85
|
+
|
|
86
|
+
### 自定义处理
|
|
87
|
+
|
|
88
|
+
#### 示例
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
import { release, changelog } from '@varlet/release'
|
|
92
|
+
|
|
93
|
+
// Do what you want to do...
|
|
94
|
+
release()
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
你可以传入一个 `task`,在包版本更改后,在发布之前会调用 `task`。
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
import { release, changelog } from '@varlet/release'
|
|
101
|
+
|
|
102
|
+
async function task() {
|
|
103
|
+
await doSomething1()
|
|
104
|
+
await doSomething2()
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
release({ task })
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### 类型
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
interface PublishCommandOptions {
|
|
114
|
+
preRelease?: boolean
|
|
115
|
+
checkRemoteVersion?: boolean
|
|
116
|
+
npmTag?: string
|
|
117
|
+
}
|
|
118
|
+
function publish({ preRelease, checkRemoteVersion, npmTag }: PublishCommandOptions): Promise<void>
|
|
119
|
+
function updateVersion(version: string): void
|
|
120
|
+
interface ReleaseCommandOptions {
|
|
121
|
+
remote?: string
|
|
122
|
+
skipNpmPublish?: boolean
|
|
123
|
+
skipChangelog?: boolean
|
|
124
|
+
skipGitTag?: boolean
|
|
125
|
+
npmTag?: string
|
|
126
|
+
task?(newVersion: string, oldVersion: string): Promise<void>
|
|
127
|
+
}
|
|
128
|
+
function release(options: ReleaseCommandOptions): Promise<void>
|
|
129
|
+
|
|
130
|
+
interface ChangelogCommandOptions {
|
|
131
|
+
file?: string
|
|
132
|
+
releaseCount?: number
|
|
133
|
+
}
|
|
134
|
+
function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
|
|
135
|
+
|
|
136
|
+
const COMMIT_MESSAGE_RE: RegExp
|
|
137
|
+
function isVersionCommitMessage(message: string): string | false | null
|
|
138
|
+
function getCommitMessage(commitMessagePath: string): string
|
|
139
|
+
interface CommitLintCommandOptions {
|
|
140
|
+
commitMessagePath: string
|
|
141
|
+
commitMessageRe?: string | RegExp
|
|
142
|
+
errorMessage?: string
|
|
143
|
+
warningMessage?: string
|
|
144
|
+
}
|
|
145
|
+
function commitLint(options: CommitLintCommandOptions): void
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
[MIT](https://github.com/varletjs/release/blob/main/LICENSE)
|
package/dist/index.cjs
CHANGED
|
@@ -255,7 +255,7 @@ async function release(options) {
|
|
|
255
255
|
}
|
|
256
256
|
updateVersion(expectVersion);
|
|
257
257
|
if (options.task) {
|
|
258
|
-
await options.task();
|
|
258
|
+
await options.task(expectVersion, currentVersion);
|
|
259
259
|
}
|
|
260
260
|
if (!options.skipNpmPublish) {
|
|
261
261
|
await publish({ preRelease: isPreRelease, npmTag: options.npmTag });
|
package/dist/index.d.cts
CHANGED
|
@@ -13,7 +13,7 @@ interface ReleaseCommandOptions {
|
|
|
13
13
|
skipChangelog?: boolean;
|
|
14
14
|
skipGitTag?: boolean;
|
|
15
15
|
checkRemoteVersion?: boolean;
|
|
16
|
-
task?(): Promise<void>;
|
|
16
|
+
task?(newVersion: string, oldVersion: string): Promise<void>;
|
|
17
17
|
}
|
|
18
18
|
declare function release(options: ReleaseCommandOptions): Promise<void>;
|
|
19
19
|
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ interface ReleaseCommandOptions {
|
|
|
13
13
|
skipChangelog?: boolean;
|
|
14
14
|
skipGitTag?: boolean;
|
|
15
15
|
checkRemoteVersion?: boolean;
|
|
16
|
-
task?(): Promise<void>;
|
|
16
|
+
task?(newVersion: string, oldVersion: string): Promise<void>;
|
|
17
17
|
}
|
|
18
18
|
declare function release(options: ReleaseCommandOptions): Promise<void>;
|
|
19
19
|
|
package/dist/index.js
CHANGED
|
@@ -211,7 +211,7 @@ async function release(options) {
|
|
|
211
211
|
}
|
|
212
212
|
updateVersion(expectVersion);
|
|
213
213
|
if (options.task) {
|
|
214
|
-
await options.task();
|
|
214
|
+
await options.task(expectVersion, currentVersion);
|
|
215
215
|
}
|
|
216
216
|
if (!options.skipNpmPublish) {
|
|
217
217
|
await publish({ preRelease: isPreRelease, npmTag: options.npmTag });
|