@varlet/release 0.3.3 → 0.4.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/LICENSE 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,161 +1,161 @@
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/LICENSE" 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
- | -p --preset \<preset\> | Specify changelog preset |
70
-
71
- #### lint-commit
72
-
73
- | Params | Instructions |
74
- | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
75
- | -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 |
76
- | -r --commitMessageRe \<reg\> | Validate the regular of whether the commit message passes |
77
- | -e --errorMessage \<message\> | Validation failed to display error messages |
78
- | -w --warningMessage \<message\> | Validation failed to display warning messages |
79
-
80
- #### publish
81
-
82
- | Params | Instructions |
83
- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
84
- | -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 |
85
- | -nt --npm-tag \<npmTag\> | npm tag |
86
-
87
- ### Custom Handle
88
-
89
- #### Example
90
-
91
- ```js
92
- import { changelog, release } from '@varlet/release'
93
-
94
- // Do what you want to do...
95
- release()
96
- ```
97
-
98
- You can pass in a task that will be called before the publish after the package version is changed.
99
-
100
- ```js
101
- import { changelog, release } from '@varlet/release'
102
-
103
- async function task() {
104
- await doSomething1()
105
- await doSomething2()
106
- }
107
-
108
- release({ task })
109
- ```
110
-
111
- #### Types
112
-
113
- ```ts
114
- interface PublishCommandOptions {
115
- preRelease?: boolean
116
- checkRemoteVersion?: boolean
117
- npmTag?: string
118
- }
119
- function publish({ preRelease, checkRemoteVersion, npmTag }: PublishCommandOptions): Promise<void>
120
- function updateVersion(version: string): void
121
- interface ReleaseCommandOptions {
122
- remote?: string
123
- skipNpmPublish?: boolean
124
- skipChangelog?: boolean
125
- skipGitTag?: boolean
126
- npmTag?: string
127
- task?(newVersion: string, oldVersion: string): Promise<void>
128
- }
129
- function release(options: ReleaseCommandOptions): Promise<void>
130
-
131
- interface ChangelogCommandOptions {
132
- file?: string
133
- releaseCount?: number
134
- preset?:
135
- | 'angular'
136
- | 'atom'
137
- | 'codemirror'
138
- | 'conventionalcommits'
139
- | 'ember'
140
- | 'eslint'
141
- | 'express'
142
- | 'jquery'
143
- | 'jshint'
144
- }
145
- function changelog({ releaseCount, file, preset }?: ChangelogCommandOptions): Promise<void>
146
-
147
- const COMMIT_MESSAGE_RE: RegExp
148
- function isVersionCommitMessage(message: string): string | false | null
149
- function getCommitMessage(commitMessagePath: string): string
150
- interface CommitLintCommandOptions {
151
- commitMessagePath: string
152
- commitMessageRe?: string | RegExp
153
- errorMessage?: string
154
- warningMessage?: string
155
- }
156
- function commitLint(options: CommitLintCommandOptions): void
157
- ```
158
-
159
- ## License
160
-
161
- [MIT](https://github.com/varletjs/release/blob/main/LICENSE)
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/LICENSE" 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
+ | -p --preset \<preset\> | Specify changelog preset |
70
+
71
+ #### lint-commit
72
+
73
+ | Params | Instructions |
74
+ | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
75
+ | -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 |
76
+ | -r --commitMessageRe \<reg\> | Validate the regular of whether the commit message passes |
77
+ | -e --errorMessage \<message\> | Validation failed to display error messages |
78
+ | -w --warningMessage \<message\> | Validation failed to display warning messages |
79
+
80
+ #### publish
81
+
82
+ | Params | Instructions |
83
+ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
84
+ | -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 |
85
+ | -nt --npm-tag \<npmTag\> | npm tag |
86
+
87
+ ### Custom Handle
88
+
89
+ #### Example
90
+
91
+ ```js
92
+ import { changelog, release } from '@varlet/release'
93
+
94
+ // Do what you want to do...
95
+ release()
96
+ ```
97
+
98
+ You can pass in a task that will be called before the publish after the package version is changed.
99
+
100
+ ```js
101
+ import { changelog, release } from '@varlet/release'
102
+
103
+ async function task() {
104
+ await doSomething1()
105
+ await doSomething2()
106
+ }
107
+
108
+ release({ task })
109
+ ```
110
+
111
+ #### Types
112
+
113
+ ```ts
114
+ interface PublishCommandOptions {
115
+ preRelease?: boolean
116
+ checkRemoteVersion?: boolean
117
+ npmTag?: string
118
+ }
119
+ function publish({ preRelease, checkRemoteVersion, npmTag }: PublishCommandOptions): Promise<void>
120
+ function updateVersion(version: string): void
121
+ interface ReleaseCommandOptions {
122
+ remote?: string
123
+ skipNpmPublish?: boolean
124
+ skipChangelog?: boolean
125
+ skipGitTag?: boolean
126
+ npmTag?: string
127
+ task?(newVersion: string, oldVersion: string): Promise<void>
128
+ }
129
+ function release(options: ReleaseCommandOptions): Promise<void>
130
+
131
+ interface ChangelogCommandOptions {
132
+ file?: string
133
+ releaseCount?: number
134
+ preset?:
135
+ | 'angular'
136
+ | 'atom'
137
+ | 'codemirror'
138
+ | 'conventionalcommits'
139
+ | 'ember'
140
+ | 'eslint'
141
+ | 'express'
142
+ | 'jquery'
143
+ | 'jshint'
144
+ }
145
+ function changelog({ releaseCount, file, preset }?: ChangelogCommandOptions): Promise<void>
146
+
147
+ const COMMIT_MESSAGE_RE: RegExp
148
+ function isVersionCommitMessage(message: string): string | false | null
149
+ function getCommitMessage(commitMessagePath: string): string
150
+ interface CommitLintCommandOptions {
151
+ commitMessagePath: string
152
+ commitMessageRe?: string | RegExp
153
+ errorMessage?: string
154
+ warningMessage?: string
155
+ }
156
+ function commitLint(options: CommitLintCommandOptions): void
157
+ ```
158
+
159
+ ## License
160
+
161
+ [MIT](https://github.com/varletjs/release/blob/main/LICENSE)
package/README.zh-CN.md CHANGED
@@ -1,161 +1,161 @@
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
- | -p --preset \<preset\> | 指定变更预设 |
70
-
71
- #### lint-commit
72
-
73
- | 参数 | 说明 |
74
- | ------------------------------- | --------------------------------------------------------------------------- |
75
- | -p --commitMessagePath \<path\> | 提交 `git message` 的临时文件路径。`git` 钩子 `commit-msg` 会传递这个参数。 |
76
- | -r --commitMessageRe \<reg\> | 验证 `commit message` 是否通过的正则 |
77
- | -e --errorMessage \<message\> | 验证失败展示的错误信息 |
78
- | -w --warningMessage \<message\> | 验证失败展示的提示信息 |
79
-
80
- #### publish
81
-
82
- | 参数 | 说明 |
83
- | ------------------------- | --------------------------------------------------------------------- |
84
- | -c --check-remote-version | 检测npm包的远程版本是否与要在本地发布的包版本相同,如果是,则跳过发布 |
85
- | -nt --npm-tag \<npmTag\> | npm tag |
86
-
87
- ### 自定义处理
88
-
89
- #### 示例
90
-
91
- ```js
92
- import { changelog, release } from '@varlet/release'
93
-
94
- // Do what you want to do...
95
- release()
96
- ```
97
-
98
- 你可以传入一个 `task`,在包版本更改后,在发布之前会调用 `task`。
99
-
100
- ```js
101
- import { changelog, release } from '@varlet/release'
102
-
103
- async function task() {
104
- await doSomething1()
105
- await doSomething2()
106
- }
107
-
108
- release({ task })
109
- ```
110
-
111
- #### 类型
112
-
113
- ```ts
114
- interface PublishCommandOptions {
115
- preRelease?: boolean
116
- checkRemoteVersion?: boolean
117
- npmTag?: string
118
- }
119
- function publish({ preRelease, checkRemoteVersion, npmTag }: PublishCommandOptions): Promise<void>
120
- function updateVersion(version: string): void
121
- interface ReleaseCommandOptions {
122
- remote?: string
123
- skipNpmPublish?: boolean
124
- skipChangelog?: boolean
125
- skipGitTag?: boolean
126
- npmTag?: string
127
- task?(newVersion: string, oldVersion: string): Promise<void>
128
- }
129
- function release(options: ReleaseCommandOptions): Promise<void>
130
-
131
- interface ChangelogCommandOptions {
132
- file?: string
133
- releaseCount?: number
134
- preset?:
135
- | 'angular'
136
- | 'atom'
137
- | 'codemirror'
138
- | 'conventionalcommits'
139
- | 'ember'
140
- | 'eslint'
141
- | 'express'
142
- | 'jquery'
143
- | 'jshint'
144
- }
145
- function changelog({ releaseCount, file, preset }?: ChangelogCommandOptions): Promise<void>
146
-
147
- const COMMIT_MESSAGE_RE: RegExp
148
- function isVersionCommitMessage(message: string): string | false | null
149
- function getCommitMessage(commitMessagePath: string): string
150
- interface CommitLintCommandOptions {
151
- commitMessagePath: string
152
- commitMessageRe?: string | RegExp
153
- errorMessage?: string
154
- warningMessage?: string
155
- }
156
- function commitLint(options: CommitLintCommandOptions): void
157
- ```
158
-
159
- ## 许可证
160
-
161
- [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
+ | -p --preset \<preset\> | 指定变更预设 |
70
+
71
+ #### lint-commit
72
+
73
+ | 参数 | 说明 |
74
+ | ------------------------------- | --------------------------------------------------------------------------- |
75
+ | -p --commitMessagePath \<path\> | 提交 `git message` 的临时文件路径。`git` 钩子 `commit-msg` 会传递这个参数。 |
76
+ | -r --commitMessageRe \<reg\> | 验证 `commit message` 是否通过的正则 |
77
+ | -e --errorMessage \<message\> | 验证失败展示的错误信息 |
78
+ | -w --warningMessage \<message\> | 验证失败展示的提示信息 |
79
+
80
+ #### publish
81
+
82
+ | 参数 | 说明 |
83
+ | ------------------------- | --------------------------------------------------------------------- |
84
+ | -c --check-remote-version | 检测npm包的远程版本是否与要在本地发布的包版本相同,如果是,则跳过发布 |
85
+ | -nt --npm-tag \<npmTag\> | npm tag |
86
+
87
+ ### 自定义处理
88
+
89
+ #### 示例
90
+
91
+ ```js
92
+ import { changelog, release } from '@varlet/release'
93
+
94
+ // Do what you want to do...
95
+ release()
96
+ ```
97
+
98
+ 你可以传入一个 `task`,在包版本更改后,在发布之前会调用 `task`。
99
+
100
+ ```js
101
+ import { changelog, release } from '@varlet/release'
102
+
103
+ async function task() {
104
+ await doSomething1()
105
+ await doSomething2()
106
+ }
107
+
108
+ release({ task })
109
+ ```
110
+
111
+ #### 类型
112
+
113
+ ```ts
114
+ interface PublishCommandOptions {
115
+ preRelease?: boolean
116
+ checkRemoteVersion?: boolean
117
+ npmTag?: string
118
+ }
119
+ function publish({ preRelease, checkRemoteVersion, npmTag }: PublishCommandOptions): Promise<void>
120
+ function updateVersion(version: string): void
121
+ interface ReleaseCommandOptions {
122
+ remote?: string
123
+ skipNpmPublish?: boolean
124
+ skipChangelog?: boolean
125
+ skipGitTag?: boolean
126
+ npmTag?: string
127
+ task?(newVersion: string, oldVersion: string): Promise<void>
128
+ }
129
+ function release(options: ReleaseCommandOptions): Promise<void>
130
+
131
+ interface ChangelogCommandOptions {
132
+ file?: string
133
+ releaseCount?: number
134
+ preset?:
135
+ | 'angular'
136
+ | 'atom'
137
+ | 'codemirror'
138
+ | 'conventionalcommits'
139
+ | 'ember'
140
+ | 'eslint'
141
+ | 'express'
142
+ | 'jquery'
143
+ | 'jshint'
144
+ }
145
+ function changelog({ releaseCount, file, preset }?: ChangelogCommandOptions): Promise<void>
146
+
147
+ const COMMIT_MESSAGE_RE: RegExp
148
+ function isVersionCommitMessage(message: string): string | false | null
149
+ function getCommitMessage(commitMessagePath: string): string
150
+ interface CommitLintCommandOptions {
151
+ commitMessagePath: string
152
+ commitMessageRe?: string | RegExp
153
+ errorMessage?: string
154
+ warningMessage?: string
155
+ }
156
+ function commitLint(options: CommitLintCommandOptions): void
157
+ ```
158
+
159
+ ## 许可证
160
+
161
+ [MIT](https://github.com/varletjs/release/blob/main/LICENSE)
package/bin/index.js CHANGED
@@ -1,47 +1,47 @@
1
- #!/usr/bin/env node
2
- import { Command } from 'commander'
3
- import fse from 'fs-extra'
4
- import { changelog, commitLint, publish, release } from '../dist/index.js'
5
-
6
- const program = new Command()
7
-
8
- const packageJson = fse.readJSONSync(new URL('../package.json', import.meta.url))
9
-
10
- program.version(packageJson.version)
11
-
12
- program
13
- .command('release')
14
- .option('-r --remote <remote>', 'Remote name')
15
- .option('-s --skip-npm-publish', 'Skip npm publish')
16
- .option('-sc --skip-changelog', 'Skip generate changelog')
17
- .option('-sgt --skip-git-tag', 'Skip git tag')
18
- .option('-nt --npm-tag <npmTag>', 'Npm tag')
19
- .option('-c --check-remote-version', 'Check remote version')
20
- .description('Release all packages and generate changelogs')
21
- .action((options) => release(options))
22
-
23
- program
24
- .command('publish')
25
- .option('-c --check-remote-version', 'Check remote version')
26
- .option('-nt --npm-tag <npmTag>', 'Npm tag')
27
- .description('Publish to npm')
28
- .action((options) => publish(options))
29
-
30
- program
31
- .command('changelog')
32
- .option('-rc --releaseCount <releaseCount>', 'Release count')
33
- .option('-f --file <file>', 'Changelog filename')
34
- .option('-p --preset <preset>', 'Changelog preset')
35
- .description('Generate changelog')
36
- .action((options) => changelog(options))
37
-
38
- program
39
- .command('commit-lint')
40
- .option('-p --commitMessagePath <path>', 'Git commit message path')
41
- .option('-r --commitMessageRe <reg>', 'Validate the regular of whether the commit message passes')
42
- .option('-e --errorMessage <message>', 'Validation failed to display error messages')
43
- .option('-w --warningMessage <message>', 'Validation failed to display warning messages')
44
- .description('Lint commit message')
45
- .action((option) => commitLint(option))
46
-
47
- program.parse()
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander'
3
+ import fse from 'fs-extra'
4
+ import { changelog, commitLint, publish, release } from '../dist/index.js'
5
+
6
+ const program = new Command()
7
+
8
+ const packageJson = fse.readJSONSync(new URL('../package.json', import.meta.url))
9
+
10
+ program.version(packageJson.version)
11
+
12
+ program
13
+ .command('release')
14
+ .option('-r --remote <remote>', 'Remote name')
15
+ .option('-s --skip-npm-publish', 'Skip npm publish')
16
+ .option('-sc --skip-changelog', 'Skip generate changelog')
17
+ .option('-sgt --skip-git-tag', 'Skip git tag')
18
+ .option('-nt --npm-tag <npmTag>', 'Npm tag')
19
+ .option('-c --check-remote-version', 'Check remote version')
20
+ .description('Release all packages and generate changelogs')
21
+ .action((options) => release(options))
22
+
23
+ program
24
+ .command('publish')
25
+ .option('-c --check-remote-version', 'Check remote version')
26
+ .option('-nt --npm-tag <npmTag>', 'Npm tag')
27
+ .description('Publish to npm')
28
+ .action((options) => publish(options))
29
+
30
+ program
31
+ .command('changelog')
32
+ .option('-rc --releaseCount <releaseCount>', 'Release count')
33
+ .option('-f --file <file>', 'Changelog filename')
34
+ .option('-p --preset <preset>', 'Changelog preset')
35
+ .description('Generate changelog')
36
+ .action((options) => changelog(options))
37
+
38
+ program
39
+ .command('commit-lint')
40
+ .option('-p --commitMessagePath <path>', 'Git commit message path')
41
+ .option('-r --commitMessageRe <reg>', 'Validate the regular of whether the commit message passes')
42
+ .option('-e --errorMessage <message>', 'Validation failed to display error messages')
43
+ .option('-w --warningMessage <message>', 'Validation failed to display warning messages')
44
+ .description('Lint commit message')
45
+ .action((option) => commitLint(option))
46
+
47
+ program.parse()
package/dist/index.cjs CHANGED
@@ -48,6 +48,7 @@ var import_prompts = require("@inquirer/prompts");
48
48
  var import_fs_extra2 = __toESM(require("fs-extra"), 1);
49
49
  var import_glob = require("glob");
50
50
  var import_nanospinner2 = require("nanospinner");
51
+ var import_rslog = require("rslog");
51
52
  var import_semver = __toESM(require("semver"), 1);
52
53
  var import_tinyexec = require("tinyexec");
53
54
 
@@ -60,37 +61,90 @@ var { createWriteStream } = import_fs_extra.default;
60
61
  function changelog({
61
62
  releaseCount = 0,
62
63
  file = "CHANGELOG.md",
63
- preset = "angular"
64
+ preset = "angular",
65
+ writerOpts = {
66
+ transform(commit, context) {
67
+ let discard = true;
68
+ const issues = [];
69
+ commit.notes.forEach((note) => {
70
+ note.title = "BREAKING CHANGES";
71
+ discard = false;
72
+ });
73
+ if (commit.type === "feat") {
74
+ commit.type = "Features";
75
+ } else if (commit.type === "fix") {
76
+ commit.type = "Bug Fixes";
77
+ } else if (commit.type === "perf") {
78
+ commit.type = "Performance Improvements";
79
+ } else if (commit.type === "revert" || commit.revert) {
80
+ commit.type = "Reverts";
81
+ } else if (commit.type === "refactor") {
82
+ commit.type = "Code Refactoring";
83
+ } else if (discard) {
84
+ return false;
85
+ } else if (commit.type === "docs") {
86
+ commit.type = "Documentation";
87
+ } else if (commit.type === "style") {
88
+ commit.type = "Styles";
89
+ } else if (commit.type === "test") {
90
+ commit.type = "Tests";
91
+ } else if (commit.type === "build") {
92
+ commit.type = "Build System";
93
+ } else if (commit.type === "ci") {
94
+ commit.type = "Continuous Integration";
95
+ }
96
+ if (commit.scope === "*") {
97
+ commit.scope = "";
98
+ }
99
+ if (typeof commit.hash === "string") {
100
+ commit.shortHash = commit.hash.substring(0, 7);
101
+ }
102
+ if (typeof commit.subject === "string") {
103
+ let url = context.repository ? `${context.host}/${context.owner}/${context.repository}` : context.repoUrl;
104
+ if (url) {
105
+ url = `${url}/issues/`;
106
+ commit.subject = commit.subject.replace(/#([0-9]+)/g, (_, issue) => {
107
+ issues.push(issue);
108
+ return `[#${issue}](${url}${issue})`;
109
+ });
110
+ }
111
+ if (context.host) {
112
+ commit.subject = commit.subject.replace(/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (_, username) => {
113
+ if (username.includes("/")) {
114
+ return `@${username}`;
115
+ }
116
+ return `[@${username}](${context.host}/${username})`;
117
+ });
118
+ }
119
+ }
120
+ commit.references = commit.references.filter((reference) => {
121
+ if (issues.indexOf(reference.issue) === -1) {
122
+ return true;
123
+ }
124
+ return false;
125
+ });
126
+ return commit;
127
+ }
128
+ }
64
129
  } = {}) {
65
130
  const s = (0, import_nanospinner.createSpinner)("Generating changelog").start();
66
131
  return new Promise((resolve2) => {
67
- (0, import_conventional_changelog.default)({
68
- preset,
69
- releaseCount
70
- }).pipe(createWriteStream((0, import_path.resolve)(process.cwd(), file))).on("close", () => {
132
+ (0, import_conventional_changelog.default)(
133
+ {
134
+ preset,
135
+ releaseCount
136
+ },
137
+ void 0,
138
+ void 0,
139
+ void 0,
140
+ writerOpts
141
+ ).pipe(createWriteStream((0, import_path.resolve)(process.cwd(), file))).on("close", () => {
71
142
  s.success({ text: "Changelog generated success!" });
72
143
  resolve2();
73
144
  });
74
145
  });
75
146
  }
76
147
 
77
- // src/logger.ts
78
- var import_picocolors = __toESM(require("picocolors"), 1);
79
- var logger_default = {
80
- info(text) {
81
- console.log(text);
82
- },
83
- success(text) {
84
- console.log(import_picocolors.default.green(text));
85
- },
86
- warning(text) {
87
- console.log(import_picocolors.default.yellow(text));
88
- },
89
- error(text) {
90
- console.log(import_picocolors.default.red(text));
91
- }
92
- };
93
-
94
148
  // src/release.ts
95
149
  var cwd = process.cwd();
96
150
  var { writeFileSync, readJSONSync } = import_fs_extra2.default;
@@ -124,7 +178,7 @@ async function publish({ preRelease, checkRemoteVersion, npmTag }) {
124
178
  const s = (0, import_nanospinner2.createSpinner)("Publishing all packages").start();
125
179
  const args = ["-r", "publish", "--no-git-checks", "--access", "public"];
126
180
  if (checkRemoteVersion && await isSameVersion()) {
127
- logger_default.error("publishing automatically skipped.");
181
+ import_rslog.logger.error("publishing automatically skipped.");
128
182
  return;
129
183
  }
130
184
  if (preRelease) {
@@ -137,7 +191,7 @@ async function publish({ preRelease, checkRemoteVersion, npmTag }) {
137
191
  throw new Error("\n" + ret.stderr);
138
192
  } else {
139
193
  s.success({ text: "Publish all packages successfully" });
140
- ret.stdout && logger_default.info(ret.stdout);
194
+ ret.stdout && import_rslog.logger.info(ret.stdout);
141
195
  }
142
196
  }
143
197
  async function pushGit(version, remote = "origin", skipGitTag = false) {
@@ -160,7 +214,7 @@ async function pushGit(version, remote = "origin", skipGitTag = false) {
160
214
  throwOnError: true
161
215
  });
162
216
  s.success({ text: "Push remote repository successfully" });
163
- ret.stdout && logger_default.info(ret.stdout);
217
+ ret.stdout && import_rslog.logger.info(ret.stdout);
164
218
  }
165
219
  function getPackageJsons() {
166
220
  const packageJsons = ["package.json", ...import_glob.glob.sync("packages/*/package.json")];
@@ -230,11 +284,11 @@ async function release(options) {
230
284
  try {
231
285
  const currentVersion = readJSONSync((0, import_path2.resolve)(cwd, "package.json")).version;
232
286
  if (!currentVersion) {
233
- logger_default.error("Your package is missing the version field");
287
+ import_rslog.logger.error("Your package is missing the version field");
234
288
  return;
235
289
  }
236
290
  if (!await isWorktreeEmpty()) {
237
- logger_default.error("Git worktree is not empty, please commit changed");
291
+ import_rslog.logger.error("Git worktree is not empty, please commit changed");
238
292
  return;
239
293
  }
240
294
  if (!await confirmRefs(options.remote)) {
@@ -245,7 +299,7 @@ async function release(options) {
245
299
  }
246
300
  const { isPreRelease, expectVersion } = await getReleaseVersion(currentVersion);
247
301
  if (options.checkRemoteVersion && await isSameVersion(expectVersion)) {
248
- logger_default.error("Please check remote version.");
302
+ import_rslog.logger.error("Please check remote version.");
249
303
  return;
250
304
  }
251
305
  updateVersion(expectVersion);
@@ -261,7 +315,7 @@ async function release(options) {
261
315
  }
262
316
  await pushGit(expectVersion, options.remote, options.skipGitTag);
263
317
  }
264
- logger_default.success(`Release version ${expectVersion} successfully!`);
318
+ import_rslog.logger.success(`Release version ${expectVersion} successfully!`);
265
319
  if (isPreRelease) {
266
320
  try {
267
321
  await (0, import_tinyexec.x)("git", ["restore", "**/package.json"], {
@@ -277,13 +331,14 @@ async function release(options) {
277
331
  }
278
332
  }
279
333
  } catch (error) {
280
- logger_default.error(error.toString());
334
+ import_rslog.logger.error(error.toString());
281
335
  process.exit(1);
282
336
  }
283
337
  }
284
338
 
285
339
  // src/commitLint.ts
286
340
  var import_fs_extra3 = __toESM(require("fs-extra"), 1);
341
+ var import_rslog2 = require("rslog");
287
342
  var import_semver2 = __toESM(require("semver"), 1);
288
343
  var { readFileSync } = import_fs_extra3.default;
289
344
  var COMMIT_MESSAGE_RE = /^(revert|fix|feat|docs|perf|test|types|style|build|chore|release|refactor|merge|wip)(\(.+\))?!?: (.|\n)+/;
@@ -333,14 +388,14 @@ function commitLint(options) {
333
388
  warningMessage = WARNING_MESSAGE
334
389
  } = options;
335
390
  if (!commitMessagePath) {
336
- logger_default.error("commitMessagePath is required");
391
+ import_rslog2.logger.error("commitMessagePath is required");
337
392
  process.exit(1);
338
393
  }
339
394
  const commitMessage = getCommitMessage(commitMessagePath);
340
395
  const isValidCommitMessage = new RegExp(commitMessageRe).test(commitMessage);
341
396
  if (!isVersionCommitMessage(commitMessage) && !isValidCommitMessage) {
342
- logger_default.error(errorMessage);
343
- logger_default.warning(warningMessage);
397
+ import_rslog2.logger.error(errorMessage);
398
+ import_rslog2.logger.warn(warningMessage);
344
399
  process.exit(1);
345
400
  }
346
401
  }
package/dist/index.d.cts CHANGED
@@ -1,3 +1,5 @@
1
+ import conventionalChangelog from 'conventional-changelog';
2
+
1
3
  declare function isSameVersion(version?: string): Promise<boolean | undefined>;
2
4
  interface PublishCommandOptions {
3
5
  preRelease?: boolean;
@@ -21,8 +23,9 @@ interface ChangelogCommandOptions {
21
23
  file?: string;
22
24
  releaseCount?: number;
23
25
  preset?: 'angular' | 'atom' | 'codemirror' | 'conventionalcommits' | 'ember' | 'eslint' | 'express' | 'jquery' | 'jshint';
26
+ writerOpts?: Parameters<typeof conventionalChangelog>['4'];
24
27
  }
25
- declare function changelog({ releaseCount, file, preset, }?: ChangelogCommandOptions): Promise<void>;
28
+ declare function changelog({ releaseCount, file, preset, writerOpts, }?: ChangelogCommandOptions): Promise<void>;
26
29
 
27
30
  declare const COMMIT_MESSAGE_RE: RegExp;
28
31
  declare function isVersionCommitMessage(message: string): string | false | null;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import conventionalChangelog from 'conventional-changelog';
2
+
1
3
  declare function isSameVersion(version?: string): Promise<boolean | undefined>;
2
4
  interface PublishCommandOptions {
3
5
  preRelease?: boolean;
@@ -21,8 +23,9 @@ interface ChangelogCommandOptions {
21
23
  file?: string;
22
24
  releaseCount?: number;
23
25
  preset?: 'angular' | 'atom' | 'codemirror' | 'conventionalcommits' | 'ember' | 'eslint' | 'express' | 'jquery' | 'jshint';
26
+ writerOpts?: Parameters<typeof conventionalChangelog>['4'];
24
27
  }
25
- declare function changelog({ releaseCount, file, preset, }?: ChangelogCommandOptions): Promise<void>;
28
+ declare function changelog({ releaseCount, file, preset, writerOpts, }?: ChangelogCommandOptions): Promise<void>;
26
29
 
27
30
  declare const COMMIT_MESSAGE_RE: RegExp;
28
31
  declare function isVersionCommitMessage(message: string): string | false | null;
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ import { confirm, select } from "@inquirer/prompts";
4
4
  import fse2 from "fs-extra";
5
5
  import { glob } from "glob";
6
6
  import { createSpinner as createSpinner2 } from "nanospinner";
7
+ import { logger } from "rslog";
7
8
  import semver from "semver";
8
9
  import { x as exec } from "tinyexec";
9
10
 
@@ -16,37 +17,90 @@ var { createWriteStream } = fse;
16
17
  function changelog({
17
18
  releaseCount = 0,
18
19
  file = "CHANGELOG.md",
19
- preset = "angular"
20
+ preset = "angular",
21
+ writerOpts = {
22
+ transform(commit, context) {
23
+ let discard = true;
24
+ const issues = [];
25
+ commit.notes.forEach((note) => {
26
+ note.title = "BREAKING CHANGES";
27
+ discard = false;
28
+ });
29
+ if (commit.type === "feat") {
30
+ commit.type = "Features";
31
+ } else if (commit.type === "fix") {
32
+ commit.type = "Bug Fixes";
33
+ } else if (commit.type === "perf") {
34
+ commit.type = "Performance Improvements";
35
+ } else if (commit.type === "revert" || commit.revert) {
36
+ commit.type = "Reverts";
37
+ } else if (commit.type === "refactor") {
38
+ commit.type = "Code Refactoring";
39
+ } else if (discard) {
40
+ return false;
41
+ } else if (commit.type === "docs") {
42
+ commit.type = "Documentation";
43
+ } else if (commit.type === "style") {
44
+ commit.type = "Styles";
45
+ } else if (commit.type === "test") {
46
+ commit.type = "Tests";
47
+ } else if (commit.type === "build") {
48
+ commit.type = "Build System";
49
+ } else if (commit.type === "ci") {
50
+ commit.type = "Continuous Integration";
51
+ }
52
+ if (commit.scope === "*") {
53
+ commit.scope = "";
54
+ }
55
+ if (typeof commit.hash === "string") {
56
+ commit.shortHash = commit.hash.substring(0, 7);
57
+ }
58
+ if (typeof commit.subject === "string") {
59
+ let url = context.repository ? `${context.host}/${context.owner}/${context.repository}` : context.repoUrl;
60
+ if (url) {
61
+ url = `${url}/issues/`;
62
+ commit.subject = commit.subject.replace(/#([0-9]+)/g, (_, issue) => {
63
+ issues.push(issue);
64
+ return `[#${issue}](${url}${issue})`;
65
+ });
66
+ }
67
+ if (context.host) {
68
+ commit.subject = commit.subject.replace(/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (_, username) => {
69
+ if (username.includes("/")) {
70
+ return `@${username}`;
71
+ }
72
+ return `[@${username}](${context.host}/${username})`;
73
+ });
74
+ }
75
+ }
76
+ commit.references = commit.references.filter((reference) => {
77
+ if (issues.indexOf(reference.issue) === -1) {
78
+ return true;
79
+ }
80
+ return false;
81
+ });
82
+ return commit;
83
+ }
84
+ }
20
85
  } = {}) {
21
86
  const s = createSpinner("Generating changelog").start();
22
87
  return new Promise((resolve2) => {
23
- conventionalChangelog({
24
- preset,
25
- releaseCount
26
- }).pipe(createWriteStream(resolvePath(process.cwd(), file))).on("close", () => {
88
+ conventionalChangelog(
89
+ {
90
+ preset,
91
+ releaseCount
92
+ },
93
+ void 0,
94
+ void 0,
95
+ void 0,
96
+ writerOpts
97
+ ).pipe(createWriteStream(resolvePath(process.cwd(), file))).on("close", () => {
27
98
  s.success({ text: "Changelog generated success!" });
28
99
  resolve2();
29
100
  });
30
101
  });
31
102
  }
32
103
 
33
- // src/logger.ts
34
- import pico from "picocolors";
35
- var logger_default = {
36
- info(text) {
37
- console.log(text);
38
- },
39
- success(text) {
40
- console.log(pico.green(text));
41
- },
42
- warning(text) {
43
- console.log(pico.yellow(text));
44
- },
45
- error(text) {
46
- console.log(pico.red(text));
47
- }
48
- };
49
-
50
104
  // src/release.ts
51
105
  var cwd = process.cwd();
52
106
  var { writeFileSync, readJSONSync } = fse2;
@@ -80,7 +134,7 @@ async function publish({ preRelease, checkRemoteVersion, npmTag }) {
80
134
  const s = createSpinner2("Publishing all packages").start();
81
135
  const args = ["-r", "publish", "--no-git-checks", "--access", "public"];
82
136
  if (checkRemoteVersion && await isSameVersion()) {
83
- logger_default.error("publishing automatically skipped.");
137
+ logger.error("publishing automatically skipped.");
84
138
  return;
85
139
  }
86
140
  if (preRelease) {
@@ -93,7 +147,7 @@ async function publish({ preRelease, checkRemoteVersion, npmTag }) {
93
147
  throw new Error("\n" + ret.stderr);
94
148
  } else {
95
149
  s.success({ text: "Publish all packages successfully" });
96
- ret.stdout && logger_default.info(ret.stdout);
150
+ ret.stdout && logger.info(ret.stdout);
97
151
  }
98
152
  }
99
153
  async function pushGit(version, remote = "origin", skipGitTag = false) {
@@ -116,7 +170,7 @@ async function pushGit(version, remote = "origin", skipGitTag = false) {
116
170
  throwOnError: true
117
171
  });
118
172
  s.success({ text: "Push remote repository successfully" });
119
- ret.stdout && logger_default.info(ret.stdout);
173
+ ret.stdout && logger.info(ret.stdout);
120
174
  }
121
175
  function getPackageJsons() {
122
176
  const packageJsons = ["package.json", ...glob.sync("packages/*/package.json")];
@@ -186,11 +240,11 @@ async function release(options) {
186
240
  try {
187
241
  const currentVersion = readJSONSync(resolve(cwd, "package.json")).version;
188
242
  if (!currentVersion) {
189
- logger_default.error("Your package is missing the version field");
243
+ logger.error("Your package is missing the version field");
190
244
  return;
191
245
  }
192
246
  if (!await isWorktreeEmpty()) {
193
- logger_default.error("Git worktree is not empty, please commit changed");
247
+ logger.error("Git worktree is not empty, please commit changed");
194
248
  return;
195
249
  }
196
250
  if (!await confirmRefs(options.remote)) {
@@ -201,7 +255,7 @@ async function release(options) {
201
255
  }
202
256
  const { isPreRelease, expectVersion } = await getReleaseVersion(currentVersion);
203
257
  if (options.checkRemoteVersion && await isSameVersion(expectVersion)) {
204
- logger_default.error("Please check remote version.");
258
+ logger.error("Please check remote version.");
205
259
  return;
206
260
  }
207
261
  updateVersion(expectVersion);
@@ -217,7 +271,7 @@ async function release(options) {
217
271
  }
218
272
  await pushGit(expectVersion, options.remote, options.skipGitTag);
219
273
  }
220
- logger_default.success(`Release version ${expectVersion} successfully!`);
274
+ logger.success(`Release version ${expectVersion} successfully!`);
221
275
  if (isPreRelease) {
222
276
  try {
223
277
  await exec("git", ["restore", "**/package.json"], {
@@ -233,13 +287,14 @@ async function release(options) {
233
287
  }
234
288
  }
235
289
  } catch (error) {
236
- logger_default.error(error.toString());
290
+ logger.error(error.toString());
237
291
  process.exit(1);
238
292
  }
239
293
  }
240
294
 
241
295
  // src/commitLint.ts
242
296
  import fse3 from "fs-extra";
297
+ import { logger as logger2 } from "rslog";
243
298
  import semver2 from "semver";
244
299
  var { readFileSync } = fse3;
245
300
  var COMMIT_MESSAGE_RE = /^(revert|fix|feat|docs|perf|test|types|style|build|chore|release|refactor|merge|wip)(\(.+\))?!?: (.|\n)+/;
@@ -289,14 +344,14 @@ function commitLint(options) {
289
344
  warningMessage = WARNING_MESSAGE
290
345
  } = options;
291
346
  if (!commitMessagePath) {
292
- logger_default.error("commitMessagePath is required");
347
+ logger2.error("commitMessagePath is required");
293
348
  process.exit(1);
294
349
  }
295
350
  const commitMessage = getCommitMessage(commitMessagePath);
296
351
  const isValidCommitMessage = new RegExp(commitMessageRe).test(commitMessage);
297
352
  if (!isVersionCommitMessage(commitMessage) && !isValidCommitMessage) {
298
- logger_default.error(errorMessage);
299
- logger_default.warning(warningMessage);
353
+ logger2.error(errorMessage);
354
+ logger2.warn(warningMessage);
300
355
  process.exit(1);
301
356
  }
302
357
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/release",
3
- "version": "0.3.3",
3
+ "version": "0.4.1",
4
4
  "description": "publish all packages, generate changelogs and check commit messages",
5
5
  "keywords": [
6
6
  "varlet",
@@ -32,15 +32,6 @@
32
32
  "files": [
33
33
  "dist"
34
34
  ],
35
- "scripts": {
36
- "build": "tsup",
37
- "clean": "rimraf node_modules dist",
38
- "commit-lint": "node bin/index.js commit-lint",
39
- "dev": "tsup --watch",
40
- "format": "prettier --write .",
41
- "lint": "eslint --fix .",
42
- "release": "pnpm build && node bin/index.js release -c"
43
- },
44
35
  "simple-git-hooks": {
45
36
  "pre-commit": "pnpm exec lint-staged --allow-empty --concurrent false",
46
37
  "commit-msg": "pnpm run commit-lint -p $1"
@@ -59,13 +50,13 @@
59
50
  "fs-extra": "^11.1.1",
60
51
  "glob": "^10.3.10",
61
52
  "nanospinner": "^1.1.0",
62
- "picocolors": "^1.0.0",
53
+ "rslog": "^1.2.3",
63
54
  "semver": "^7.5.4",
64
55
  "tinyexec": "^0.3.0"
65
56
  },
66
57
  "devDependencies": {
67
- "@configurajs/eslint": "^0.1.0",
68
- "@configurajs/prettier": "^0.1.1",
58
+ "@configurajs/eslint": "^0.1.2",
59
+ "@configurajs/prettier": "^0.1.4",
69
60
  "@types/conventional-changelog": "^3.1.5",
70
61
  "@types/fs-extra": "^11.0.4",
71
62
  "@types/node": "^20.9.0",
@@ -79,9 +70,18 @@
79
70
  "tsup": "^8.3.0",
80
71
  "typescript": "^5.2.2"
81
72
  },
82
- "packageManager": "pnpm@9.0.1",
83
73
  "engines": {
84
74
  "node": ">=16.0.0",
85
75
  "pnpm": ">=9.0"
76
+ },
77
+ "scripts": {
78
+ "build": "tsup",
79
+ "clean": "rimraf node_modules dist",
80
+ "commit-lint": "node bin/index.js commit-lint",
81
+ "dev": "tsup --watch",
82
+ "format": "prettier --write .",
83
+ "lint": "eslint --fix .",
84
+ "release": "pnpm build && node bin/index.js release -c",
85
+ "type-check": "tsc --noEmit"
86
86
  }
87
87
  }