@varlet/release 0.2.6 → 0.2.8

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 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,163 +1,163 @@
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
- | -sc --skip-changelog | Skip generate changelog |
73
- | -sgt --skip-git-tag | Skip git tag |
74
- | -nt --npm-tag \<npmTag\> | npm tag |
75
-
76
- #### changelog
77
-
78
- | Params | Instructions |
79
- | ----------------------------------- | -------------------------- |
80
- | -f --file \<filename\> | Specify changelog filename |
81
- | -rc --releaseCount \<releaseCount\> | Release count |
82
-
83
- #### lint-commit
84
-
85
- | Params | Instructions |
86
- | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
87
- | -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 |
88
- | -r --commitMessageRe \<reg\> | Validate the regular of whether the commit message passes |
89
- | -e --errorMessage \<message\> | Validation failed to display error messages |
90
- | -w --warningMessage \<message\> | Validation failed to display warning messages |
91
-
92
- #### publish
93
-
94
- | Params | Instructions |
95
- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
96
- | -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 |
97
- | -nt --npm-tag \<npmTag\> | npm tag |
98
-
99
- ### Custom Handle
100
-
101
- #### Example
102
-
103
- ```js
104
- import { release, changelog } from '@varlet/release'
105
-
106
- // Do what you want to do...
107
- release()
108
- ```
109
-
110
- You can pass in a task that will be called before the publish after the package version is changed.
111
-
112
- ```js
113
- import { release, changelog } from '@varlet/release'
114
-
115
- async function task() {
116
- await doSomething1()
117
- await doSomething2()
118
- }
119
-
120
- release({ task })
121
- ```
122
-
123
- #### Types
124
-
125
- ```ts
126
- interface PublishCommandOptions {
127
- preRelease?: boolean
128
- checkRemoteVersion?: boolean
129
- npmTag?: string
130
- }
131
- function publish({ preRelease, checkRemoteVersion, npmTag }: PublishCommandOptions): Promise<void>
132
- function updateVersion(version: string): void
133
- interface ReleaseCommandOptions {
134
- remote?: string
135
- skipNpmPublish?: boolean
136
- skipChangelog?: boolean
137
- skipGitTag?: boolean
138
- npmTag?: string
139
- task?(): Promise<void>
140
- }
141
- function release(options: ReleaseCommandOptions): Promise<void>
142
-
143
- interface ChangelogCommandOptions {
144
- file?: string
145
- releaseCount?: number
146
- }
147
- function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
148
-
149
- const COMMIT_MESSAGE_RE: RegExp
150
- function isVersionCommitMessage(message: string): string | false | null
151
- function getCommitMessage(commitMessagePath: string): string
152
- interface CommitLintCommandOptions {
153
- commitMessagePath: string
154
- commitMessageRe?: string | RegExp
155
- errorMessage?: string
156
- warningMessage?: string
157
- }
158
- function commitLint(options: CommitLintCommandOptions): void
159
- ```
160
-
161
- ## License
162
-
163
- [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 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
+ | -sc --skip-changelog | Skip generate changelog |
73
+ | -sgt --skip-git-tag | Skip git tag |
74
+ | -nt --npm-tag \<npmTag\> | npm tag |
75
+
76
+ #### changelog
77
+
78
+ | Params | Instructions |
79
+ | ----------------------------------- | -------------------------- |
80
+ | -f --file \<filename\> | Specify changelog filename |
81
+ | -rc --releaseCount \<releaseCount\> | Release count |
82
+
83
+ #### lint-commit
84
+
85
+ | Params | Instructions |
86
+ | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
87
+ | -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 |
88
+ | -r --commitMessageRe \<reg\> | Validate the regular of whether the commit message passes |
89
+ | -e --errorMessage \<message\> | Validation failed to display error messages |
90
+ | -w --warningMessage \<message\> | Validation failed to display warning messages |
91
+
92
+ #### publish
93
+
94
+ | Params | Instructions |
95
+ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
96
+ | -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 |
97
+ | -nt --npm-tag \<npmTag\> | npm tag |
98
+
99
+ ### Custom Handle
100
+
101
+ #### Example
102
+
103
+ ```js
104
+ import { release, changelog } from '@varlet/release'
105
+
106
+ // Do what you want to do...
107
+ release()
108
+ ```
109
+
110
+ You can pass in a task that will be called before the publish after the package version is changed.
111
+
112
+ ```js
113
+ import { release, changelog } from '@varlet/release'
114
+
115
+ async function task() {
116
+ await doSomething1()
117
+ await doSomething2()
118
+ }
119
+
120
+ release({ task })
121
+ ```
122
+
123
+ #### Types
124
+
125
+ ```ts
126
+ interface PublishCommandOptions {
127
+ preRelease?: boolean
128
+ checkRemoteVersion?: boolean
129
+ npmTag?: string
130
+ }
131
+ function publish({ preRelease, checkRemoteVersion, npmTag }: PublishCommandOptions): Promise<void>
132
+ function updateVersion(version: string): void
133
+ interface ReleaseCommandOptions {
134
+ remote?: string
135
+ skipNpmPublish?: boolean
136
+ skipChangelog?: boolean
137
+ skipGitTag?: boolean
138
+ npmTag?: string
139
+ task?(): Promise<void>
140
+ }
141
+ function release(options: ReleaseCommandOptions): Promise<void>
142
+
143
+ interface ChangelogCommandOptions {
144
+ file?: string
145
+ releaseCount?: number
146
+ }
147
+ function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
148
+
149
+ const COMMIT_MESSAGE_RE: RegExp
150
+ function isVersionCommitMessage(message: string): string | false | null
151
+ function getCommitMessage(commitMessagePath: string): string
152
+ interface CommitLintCommandOptions {
153
+ commitMessagePath: string
154
+ commitMessageRe?: string | RegExp
155
+ errorMessage?: string
156
+ warningMessage?: string
157
+ }
158
+ function commitLint(options: CommitLintCommandOptions): void
159
+ ```
160
+
161
+ ## License
162
+
163
+ [MIT](https://github.com/varletjs/release/blob/main/LICENCE)
package/README.zh-CN.md CHANGED
@@ -1,163 +1,163 @@
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
- | -sc --skip-changelog | 跳过生成变更日志 |
73
- | -sgt --skip-git-tag | 跳过 git tag |
74
- | -nt --npm-tag \<npmTag\> | npm tag |
75
-
76
- #### changelog
77
-
78
- | 参数 | 说明 |
79
- | ----------------------------------- | ------------------ |
80
- | -f --file \<filename\> | 指定变更日志文件名 |
81
- | -rc --releaseCount \<releaseCount\> | 发布数量 |
82
-
83
- #### lint-commit
84
-
85
- | 参数 | 说明 |
86
- | ------------------------------- | --------------------------------------------------------------------------- |
87
- | -p --commitMessagePath \<path\> | 提交 `git message` 的临时文件路径。`git` 钩子 `commit-msg` 会传递这个参数。 |
88
- | -r --commitMessageRe \<reg\> | 验证 `commit message` 是否通过的正则 |
89
- | -e --errorMessage \<message\> | 验证失败展示的错误信息 |
90
- | -w --warningMessage \<message\> | 验证失败展示的提示信息 |
91
-
92
- #### publish
93
-
94
- | 参数 | 说明 |
95
- | ------------------------- | --------------------------------------------------------------------- |
96
- | -c --check-remote-version | 检测npm包的远程版本是否与要在本地发布的包版本相同,如果是,则跳过发布 |
97
- | -nt --npm-tag \<npmTag\> | npm tag |
98
-
99
- ### 自定义处理
100
-
101
- #### 示例
102
-
103
- ```js
104
- import { release, changelog } from '@varlet/release'
105
-
106
- // Do what you want to do...
107
- release()
108
- ```
109
-
110
- 你可以传入一个 `task`,在包版本更改后,在发布之前会调用 `task`。
111
-
112
- ```js
113
- import { release, changelog } from '@varlet/release'
114
-
115
- async function task() {
116
- await doSomething1()
117
- await doSomething2()
118
- }
119
-
120
- release({ task })
121
- ```
122
-
123
- #### 类型
124
-
125
- ```ts
126
- interface PublishCommandOptions {
127
- preRelease?: boolean
128
- checkRemoteVersion?: boolean
129
- npmTag?: string
130
- }
131
- function publish({ preRelease, checkRemoteVersion, npmTag }: PublishCommandOptions): Promise<void>
132
- function updateVersion(version: string): void
133
- interface ReleaseCommandOptions {
134
- remote?: string
135
- skipNpmPublish?: boolean
136
- skipChangelog?: boolean
137
- skipGitTag?: boolean
138
- npmTag?: string
139
- task?(): Promise<void>
140
- }
141
- function release(options: ReleaseCommandOptions): Promise<void>
142
-
143
- interface ChangelogCommandOptions {
144
- file?: string
145
- releaseCount?: number
146
- }
147
- function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
148
-
149
- const COMMIT_MESSAGE_RE: RegExp
150
- function isVersionCommitMessage(message: string): string | false | null
151
- function getCommitMessage(commitMessagePath: string): string
152
- interface CommitLintCommandOptions {
153
- commitMessagePath: string
154
- commitMessageRe?: string | RegExp
155
- errorMessage?: string
156
- warningMessage?: string
157
- }
158
- function commitLint(options: CommitLintCommandOptions): void
159
- ```
160
-
161
- ## License
162
-
163
- [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` 的工具。
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
+ | -sc --skip-changelog | 跳过生成变更日志 |
73
+ | -sgt --skip-git-tag | 跳过 git tag |
74
+ | -nt --npm-tag \<npmTag\> | npm tag |
75
+
76
+ #### changelog
77
+
78
+ | 参数 | 说明 |
79
+ | ----------------------------------- | ------------------ |
80
+ | -f --file \<filename\> | 指定变更日志文件名 |
81
+ | -rc --releaseCount \<releaseCount\> | 发布数量 |
82
+
83
+ #### lint-commit
84
+
85
+ | 参数 | 说明 |
86
+ | ------------------------------- | --------------------------------------------------------------------------- |
87
+ | -p --commitMessagePath \<path\> | 提交 `git message` 的临时文件路径。`git` 钩子 `commit-msg` 会传递这个参数。 |
88
+ | -r --commitMessageRe \<reg\> | 验证 `commit message` 是否通过的正则 |
89
+ | -e --errorMessage \<message\> | 验证失败展示的错误信息 |
90
+ | -w --warningMessage \<message\> | 验证失败展示的提示信息 |
91
+
92
+ #### publish
93
+
94
+ | 参数 | 说明 |
95
+ | ------------------------- | --------------------------------------------------------------------- |
96
+ | -c --check-remote-version | 检测npm包的远程版本是否与要在本地发布的包版本相同,如果是,则跳过发布 |
97
+ | -nt --npm-tag \<npmTag\> | npm tag |
98
+
99
+ ### 自定义处理
100
+
101
+ #### 示例
102
+
103
+ ```js
104
+ import { release, changelog } from '@varlet/release'
105
+
106
+ // Do what you want to do...
107
+ release()
108
+ ```
109
+
110
+ 你可以传入一个 `task`,在包版本更改后,在发布之前会调用 `task`。
111
+
112
+ ```js
113
+ import { release, changelog } from '@varlet/release'
114
+
115
+ async function task() {
116
+ await doSomething1()
117
+ await doSomething2()
118
+ }
119
+
120
+ release({ task })
121
+ ```
122
+
123
+ #### 类型
124
+
125
+ ```ts
126
+ interface PublishCommandOptions {
127
+ preRelease?: boolean
128
+ checkRemoteVersion?: boolean
129
+ npmTag?: string
130
+ }
131
+ function publish({ preRelease, checkRemoteVersion, npmTag }: PublishCommandOptions): Promise<void>
132
+ function updateVersion(version: string): void
133
+ interface ReleaseCommandOptions {
134
+ remote?: string
135
+ skipNpmPublish?: boolean
136
+ skipChangelog?: boolean
137
+ skipGitTag?: boolean
138
+ npmTag?: string
139
+ task?(): Promise<void>
140
+ }
141
+ function release(options: ReleaseCommandOptions): Promise<void>
142
+
143
+ interface ChangelogCommandOptions {
144
+ file?: string
145
+ releaseCount?: number
146
+ }
147
+ function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
148
+
149
+ const COMMIT_MESSAGE_RE: RegExp
150
+ function isVersionCommitMessage(message: string): string | false | null
151
+ function getCommitMessage(commitMessagePath: string): string
152
+ interface CommitLintCommandOptions {
153
+ commitMessagePath: string
154
+ commitMessageRe?: string | RegExp
155
+ errorMessage?: string
156
+ warningMessage?: string
157
+ }
158
+ function commitLint(options: CommitLintCommandOptions): void
159
+ ```
160
+
161
+ ## License
162
+
163
+ [MIT](https://github.com/varletjs/release/blob/main/LICENSE)
package/bin/index.js CHANGED
@@ -1,40 +1,40 @@
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('-sc --skip-changelog', 'Skip generate changelog')
12
- .option('-sgt --skip-git-tag', 'Skip git tag')
13
- .option('-nt --npm-tag <npmTag>', 'Npm tag')
14
- .description('Release all packages and generate changelogs')
15
- .action(async (options) => release(options))
16
-
17
- program
18
- .command('publish')
19
- .option('-c --check-remote-version', 'Check remote version')
20
- .option('-nt --npm-tag <npmTag>', 'Npm tag')
21
- .description('Publish to npm')
22
- .action(async (options) => publish(options))
23
-
24
- program
25
- .command('changelog')
26
- .option('-rc --releaseCount <releaseCount>', 'Release count')
27
- .option('-f --file <file>', 'Changelog filename')
28
- .description('Generate changelog')
29
- .action(async (options) => changelog(options))
30
-
31
- program
32
- .command('commit-lint')
33
- .option('-p --commitMessagePath <path>', 'Git commit message path')
34
- .option('-r --commitMessageRe <reg>', 'Validate the regular of whether the commit message passes')
35
- .option('-e --errorMessage <message>', 'Validation failed to display error messages')
36
- .option('-w --warningMessage <message>', 'Validation failed to display warning messages')
37
- .description('Lint commit message')
38
- .action(async (option) => commitLint(option))
39
-
40
- program.parse()
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('-sc --skip-changelog', 'Skip generate changelog')
12
+ .option('-sgt --skip-git-tag', 'Skip git tag')
13
+ .option('-nt --npm-tag <npmTag>', 'Npm tag')
14
+ .description('Release all packages and generate changelogs')
15
+ .action(async (options) => release(options))
16
+
17
+ program
18
+ .command('publish')
19
+ .option('-c --check-remote-version', 'Check remote version')
20
+ .option('-nt --npm-tag <npmTag>', 'Npm tag')
21
+ .description('Publish to npm')
22
+ .action(async (options) => publish(options))
23
+
24
+ program
25
+ .command('changelog')
26
+ .option('-rc --releaseCount <releaseCount>', 'Release count')
27
+ .option('-f --file <file>', 'Changelog filename')
28
+ .description('Generate changelog')
29
+ .action(async (options) => changelog(options))
30
+
31
+ program
32
+ .command('commit-lint')
33
+ .option('-p --commitMessagePath <path>', 'Git commit message path')
34
+ .option('-r --commitMessageRe <reg>', 'Validate the regular of whether the commit message passes')
35
+ .option('-e --errorMessage <message>', 'Validation failed to display error messages')
36
+ .option('-w --warningMessage <message>', 'Validation failed to display warning messages')
37
+ .description('Lint commit message')
38
+ .action(async (option) => commitLint(option))
39
+
40
+ program.parse()
package/dist/index.cjs CHANGED
@@ -96,6 +96,7 @@ var cwd = process.cwd();
96
96
  var { writeFileSync, readJSONSync } = import_fs_extra2.default;
97
97
  var { prompt } = import_inquirer.default;
98
98
  var releaseTypes = ["premajor", "preminor", "prepatch", "major", "minor", "patch"];
99
+ var BACK_HINT = "Back to previous step";
99
100
  async function isWorktreeEmpty() {
100
101
  const ret = await (0, import_execa.execa)("git", ["status", "--porcelain"]);
101
102
  return !ret.stdout;
@@ -176,8 +177,8 @@ async function confirmVersion(currentVersion, expectVersion) {
176
177
  const ret = await prompt([
177
178
  {
178
179
  name,
179
- type: "confirm",
180
- message: `All packages version ${currentVersion} -> ${expectVersion}:`
180
+ type: "list",
181
+ choices: [`All packages version ${currentVersion} -> ${expectVersion}`, BACK_HINT]
181
182
  }
182
183
  ]);
183
184
  return ret[name];
@@ -208,6 +209,19 @@ async function getReleaseType() {
208
209
  ]);
209
210
  return ret[name];
210
211
  }
212
+ async function getReleaseVersion(currentVersion) {
213
+ let isPreRelease = false;
214
+ let expectVersion = "";
215
+ let confirmVersionRet = "";
216
+ do {
217
+ const type = await getReleaseType();
218
+ isPreRelease = type.startsWith("pre");
219
+ expectVersion = import_semver.default.inc(currentVersion, type, `alpha.${Date.now()}`);
220
+ expectVersion = isPreRelease ? expectVersion.slice(0, -2) : expectVersion;
221
+ confirmVersionRet = await confirmVersion(currentVersion, expectVersion);
222
+ } while (confirmVersionRet === BACK_HINT);
223
+ return { isPreRelease, expectVersion };
224
+ }
211
225
  async function release(options) {
212
226
  try {
213
227
  const currentVersion = readJSONSync((0, import_path2.resolve)(cwd, "package.json")).version;
@@ -225,13 +239,7 @@ async function release(options) {
225
239
  if (!await confirmRegistry()) {
226
240
  return;
227
241
  }
228
- const type = await getReleaseType();
229
- const isPreRelease = type.startsWith("pre");
230
- let expectVersion = import_semver.default.inc(currentVersion, type, `alpha.${Date.now()}`);
231
- expectVersion = isPreRelease ? expectVersion.slice(0, -2) : expectVersion;
232
- if (!await confirmVersion(currentVersion, expectVersion)) {
233
- return;
234
- }
242
+ const { isPreRelease, expectVersion } = await getReleaseVersion(currentVersion);
235
243
  updateVersion(expectVersion);
236
244
  if (options.task) {
237
245
  await options.task();
package/dist/index.js CHANGED
@@ -53,6 +53,7 @@ var cwd = process.cwd();
53
53
  var { writeFileSync, readJSONSync } = fse2;
54
54
  var { prompt } = inquirer;
55
55
  var releaseTypes = ["premajor", "preminor", "prepatch", "major", "minor", "patch"];
56
+ var BACK_HINT = "Back to previous step";
56
57
  async function isWorktreeEmpty() {
57
58
  const ret = await execa("git", ["status", "--porcelain"]);
58
59
  return !ret.stdout;
@@ -133,8 +134,8 @@ async function confirmVersion(currentVersion, expectVersion) {
133
134
  const ret = await prompt([
134
135
  {
135
136
  name,
136
- type: "confirm",
137
- message: `All packages version ${currentVersion} -> ${expectVersion}:`
137
+ type: "list",
138
+ choices: [`All packages version ${currentVersion} -> ${expectVersion}`, BACK_HINT]
138
139
  }
139
140
  ]);
140
141
  return ret[name];
@@ -165,6 +166,19 @@ async function getReleaseType() {
165
166
  ]);
166
167
  return ret[name];
167
168
  }
169
+ async function getReleaseVersion(currentVersion) {
170
+ let isPreRelease = false;
171
+ let expectVersion = "";
172
+ let confirmVersionRet = "";
173
+ do {
174
+ const type = await getReleaseType();
175
+ isPreRelease = type.startsWith("pre");
176
+ expectVersion = semver.inc(currentVersion, type, `alpha.${Date.now()}`);
177
+ expectVersion = isPreRelease ? expectVersion.slice(0, -2) : expectVersion;
178
+ confirmVersionRet = await confirmVersion(currentVersion, expectVersion);
179
+ } while (confirmVersionRet === BACK_HINT);
180
+ return { isPreRelease, expectVersion };
181
+ }
168
182
  async function release(options) {
169
183
  try {
170
184
  const currentVersion = readJSONSync(resolve(cwd, "package.json")).version;
@@ -182,13 +196,7 @@ async function release(options) {
182
196
  if (!await confirmRegistry()) {
183
197
  return;
184
198
  }
185
- const type = await getReleaseType();
186
- const isPreRelease = type.startsWith("pre");
187
- let expectVersion = semver.inc(currentVersion, type, `alpha.${Date.now()}`);
188
- expectVersion = isPreRelease ? expectVersion.slice(0, -2) : expectVersion;
189
- if (!await confirmVersion(currentVersion, expectVersion)) {
190
- return;
191
- }
199
+ const { isPreRelease, expectVersion } = await getReleaseVersion(currentVersion);
192
200
  updateVersion(expectVersion);
193
201
  if (options.task) {
194
202
  await options.task();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@varlet/release",
3
3
  "type": "module",
4
- "version": "0.2.6",
4
+ "version": "0.2.8",
5
5
  "description": "release all packages and generate changelogs",
6
6
  "keywords": [
7
7
  "varlet",