@varlet/release 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENCE 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,135 +1,153 @@
1
- <h1 align="center">Varlet Release</h1>
2
-
3
- <p align="center">
4
- <span>English</span> |
5
- <a href="https://github.com/varletjs/release/blob/main/README.zh-CN.md">中文</a>
6
- </p>
7
- <p align="center">
8
- <a href="https://www.npmjs.com/package/@varlet/release" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/npm/v/@varlet/release" alt="NPM Version" /></a>
9
- <a href="https://github.com/varletjs/release/blob/main/LICENCE" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/github/license/varletjs/release" alt="License" /></a>
10
- </p>
11
-
12
- ## Intro
13
-
14
- `Varlet Release` is a tool to release all packages, generate changelogs and lint commit message.
15
-
16
- ## Installation
17
-
18
- ### npm
19
-
20
- ```shell
21
- npm i @varlet/release -D
22
- ```
23
-
24
- ### yarn
25
-
26
- ```shell
27
- yarn add @varlet/release -D
28
- ```
29
-
30
- ### pnpm
31
-
32
- ```shell
33
- pnpm add @varlet/release -D
34
- ```
35
-
36
- ## Usage
37
-
38
- ### Using Command
39
-
40
- ```shell
41
- # Release all packages and generate changelogs
42
- npx vr release
43
-
44
- # Specify remote name
45
- npx vr release -r https://github.com/varletjs/varlet-release
46
- # or
47
- npx vr release --remote https://github.com/varletjs/varlet-release
48
-
49
- # Just generate changelogs
50
- npx vr changelog
51
-
52
- # Specify changelog filename
53
- npx vr changelog -f changelog.md
54
- # or
55
- npx vr changelog --file changelog.md
56
-
57
- # Lint commit message
58
- npx vr lint-commit -p .git/COMMIT_EDITMSG
59
- ```
60
-
61
- ### Configuration
62
-
63
- #### release
64
-
65
- | Params | Instructions |
66
- | ---------------------- | ------------------- |
67
- | -r --remote \<remote\> | Specify remote name |
68
-
69
- #### changelog
70
-
71
- | Params | Instructions |
72
- | ----------------------------------- | -------------------------- |
73
- | -f --file \<filename\> | Specify changelog filename |
74
- | -rc --releaseCount \<releaseCount\> | Release count |
75
-
76
- #### lint-commit
77
-
78
- | Params | Instructions |
79
- | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
80
- | -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 |
81
- | -r --commitMessageRe \<reg\> | Validate the regular of whether the commit message passes |
82
- | -e --errorMessage \<message\> | Validation failed to display error messages |
83
- | -w --warningMessage \<message\> | Validation failed to display warning messages |
84
-
85
- ### Custom Handle
86
-
87
- #### Example
88
-
89
- ```js
90
- import { release, changelog } from '@varlet/release'
91
-
92
- // Do what you want to do...
93
- release()
94
- ```
95
-
96
- You can pass in a task that will be called before the publish after the package version is changed.
97
-
98
- ```js
99
- import { release, changelog } from '@varlet/release'
100
-
101
- async function task() {
102
- await doSomething1()
103
- await doSomething2()
104
- }
105
-
106
- release({ task })
107
- ```
108
-
109
- #### Types
110
-
111
- ```ts
112
- interface ReleaseCommandOptions {
113
- remote?: string
114
- task?(): Promise<void>
115
- }
116
- function release(options: ReleaseCommandOptions): Promise<void>
117
-
118
- interface ChangelogCommandOptions {
119
- file?: string
120
- releaseCount?: number
121
- }
122
- function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
123
-
124
- interface CommitLintCommandOptions {
125
- commitMessagePath: string
126
- commitMessageRe?: string | RegExp
127
- errorMessage?: string
128
- warningMessage?: string
129
- }
130
- function commitLint(options: CommitLintCommandOptions): void
131
- ```
132
-
133
- ## License
134
-
135
- [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
+ | -sgt --skip-git-tag | Skip git tag |
73
+
74
+ #### changelog
75
+
76
+ | Params | Instructions |
77
+ | ----------------------------------- | -------------------------- |
78
+ | -f --file \<filename\> | Specify changelog filename |
79
+ | -rc --releaseCount \<releaseCount\> | Release count |
80
+
81
+ #### lint-commit
82
+
83
+ | Params | Instructions |
84
+ | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
85
+ | -p --commitMessagePath \<path\> | The path of the temporary file to which the git message is submitted. The git hook commit-msg will pass this parameter |
86
+ | -r --commitMessageRe \<reg\> | Validate the regular of whether the commit message passes |
87
+ | -e --errorMessage \<message\> | Validation failed to display error messages |
88
+ | -w --warningMessage \<message\> | Validation failed to display warning messages |
89
+
90
+ #### publish
91
+
92
+ ```shell
93
+ vr publish
94
+ ```
95
+
96
+ ### Custom Handle
97
+
98
+ #### Example
99
+
100
+ ```js
101
+ import { release, changelog } from '@varlet/release'
102
+
103
+ // Do what you want to do...
104
+ release()
105
+ ```
106
+
107
+ You can pass in a task that will be called before the publish after the package version is changed.
108
+
109
+ ```js
110
+ import { release, changelog } from '@varlet/release'
111
+
112
+ async function task() {
113
+ await doSomething1()
114
+ await doSomething2()
115
+ }
116
+
117
+ release({ task })
118
+ ```
119
+
120
+ #### Types
121
+
122
+ ```ts
123
+ function publish(preRelease: boolean | undefined): Promise<void>
124
+ function updateVersion(version: string): void
125
+ interface ReleaseCommandOptions {
126
+ remote?: string
127
+ skipNpmPublish?: boolean
128
+ skipGitTag?: boolean
129
+ task?(): Promise<void>
130
+ }
131
+ function release(options: ReleaseCommandOptions): Promise<void>
132
+
133
+ interface ChangelogCommandOptions {
134
+ file?: string
135
+ releaseCount?: number
136
+ }
137
+ function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
138
+
139
+ const COMMIT_MESSAGE_RE: RegExp
140
+ function isVersionCommitMessage(message: string): string | false | null
141
+ function getCommitMessage(commitMessagePath: string): string
142
+ interface CommitLintCommandOptions {
143
+ commitMessagePath: string
144
+ commitMessageRe?: string | RegExp
145
+ errorMessage?: string
146
+ warningMessage?: string
147
+ }
148
+ function commitLint(options: CommitLintCommandOptions): void
149
+ ```
150
+
151
+ ## License
152
+
153
+ [MIT](https://github.com/varletjs/release/blob/main/LICENCE)
package/README.zh-CN.md CHANGED
@@ -1,135 +1,153 @@
1
- <h1 align="center">Varlet Release</h1>
2
-
3
- <p align="center">
4
- <span>中文</span> |
5
- <a href="https://github.com/varletjs/release/blob/main/README.md">English</a>
6
- </p>
7
- <p align="center">
8
- <a href="https://www.npmjs.com/package/@varlet/release" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/npm/v/@varlet/release" alt="NPM Version" /></a>
9
- <a href="https://github.com/valetjs/release/blob/master/LICENSE" target="_blank" rel="noopener noreferrer"><img src="https://badgen.net/github/license/varletjs/release" alt="License" /></a>
10
- </p>
11
-
12
- ## 介绍
13
-
14
- `Varlet Release` 是一个用于发布所有包、生成变更日志和检测 `commit message` 的工具。
15
-
16
- ## 安装
17
-
18
- ### npm
19
-
20
- ```shell
21
- npm i @varlet/release -D
22
- ```
23
-
24
- ### yarn
25
-
26
- ```shell
27
- yarn add @varlet/release -D
28
- ```
29
-
30
- ### pnpm
31
-
32
- ```shell
33
- pnpm add @varlet/release -D
34
- ```
35
-
36
- ## 使用
37
-
38
- ### 使用命令
39
-
40
- ```shell
41
- # 发布所有包并生成变更日志
42
- npx vr release
43
-
44
- # 指定远程仓库名称
45
- npx vr release -r https://github.com/varletjs/varlet-release
46
- # or
47
- npx vr release --remote https://github.com/varletjs/varlet-release
48
-
49
- # 仅生成变更日志
50
- npx vr changelog
51
-
52
- # 指定变更日志文件名
53
- npx vr changelog -f changelog.md
54
- # or
55
- npx vr changelog --file changelog.md
56
-
57
- # 检测 commit message
58
- npx vr lint-commit -p .git/COMMIT_EDITMSG
59
- ```
60
-
61
- ### 配置
62
-
63
- #### release
64
-
65
- | 参数 | 说明 |
66
- | ---------------------- | ---------------- |
67
- | -r --remote \<remote\> | 指定远程仓库名称 |
68
-
69
- #### changelog
70
-
71
- | 参数 | 说明 |
72
- | ----------------------------------- | ------------------ |
73
- | -f --file \<filename\> | 指定变更日志文件名 |
74
- | -rc --releaseCount \<releaseCount\> | 发布数量 |
75
-
76
- #### lint-commit
77
-
78
- | 参数 | 说明 |
79
- | ------------------------------- | --------------------------------------------------------------------------- |
80
- | -p --commitMessagePath \<path\> | 提交 `git message` 的临时文件路径。`git` 钩子 `commit-msg` 会传递这个参数。 |
81
- | -r --commitMessageRe \<reg\> | 验证 `commit message` 是否通过的正则 |
82
- | -e --errorMessage \<message\> | 验证失败展示的错误信息 |
83
- | -w --warningMessage \<message\> | 验证失败展示的提示信息 |
84
-
85
- ### 自定义处理
86
-
87
- #### 示例
88
-
89
- ```js
90
- import { release, changelog } from '@varlet/release'
91
-
92
- // Do what you want to do...
93
- release()
94
- ```
95
-
96
- 你可以传入一个 `task`,在包版本更改后,在发布之前会调用 `task`。
97
-
98
- ```js
99
- import { release, changelog } from '@varlet/release'
100
-
101
- async function task() {
102
- await doSomething1()
103
- await doSomething2()
104
- }
105
-
106
- release({ task })
107
- ```
108
-
109
- #### 类型
110
-
111
- ```ts
112
- interface ReleaseCommandOptions {
113
- remote?: string
114
- task?(): Promise<void>
115
- }
116
- function release(options: ReleaseCommandOptions): Promise<void>
117
-
118
- interface ChangelogCommandOptions {
119
- file?: string
120
- releaseCount?: number
121
- }
122
- function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
123
-
124
- interface CommitLintCommandOptions {
125
- commitMessagePath: string
126
- commitMessageRe?: string | RegExp
127
- errorMessage?: string
128
- warningMessage?: string
129
- }
130
- function commitLint(options: CommitLintCommandOptions): void
131
- ```
132
-
133
- ## License
134
-
135
- [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
+ | -sgt --skip-git-tag | 跳过 git tag |
73
+
74
+ #### changelog
75
+
76
+ | 参数 | 说明 |
77
+ | ----------------------------------- | ------------------ |
78
+ | -f --file \<filename\> | 指定变更日志文件名 |
79
+ | -rc --releaseCount \<releaseCount\> | 发布数量 |
80
+
81
+ #### lint-commit
82
+
83
+ | 参数 | 说明 |
84
+ | ------------------------------- | --------------------------------------------------------------------------- |
85
+ | -p --commitMessagePath \<path\> | 提交 `git message` 的临时文件路径。`git` 钩子 `commit-msg` 会传递这个参数。 |
86
+ | -r --commitMessageRe \<reg\> | 验证 `commit message` 是否通过的正则 |
87
+ | -e --errorMessage \<message\> | 验证失败展示的错误信息 |
88
+ | -w --warningMessage \<message\> | 验证失败展示的提示信息 |
89
+
90
+ #### publish
91
+
92
+ ```shell
93
+ vr publish
94
+ ```
95
+
96
+ ### 自定义处理
97
+
98
+ #### 示例
99
+
100
+ ```js
101
+ import { release, changelog } from '@varlet/release'
102
+
103
+ // Do what you want to do...
104
+ release()
105
+ ```
106
+
107
+ 你可以传入一个 `task`,在包版本更改后,在发布之前会调用 `task`。
108
+
109
+ ```js
110
+ import { release, changelog } from '@varlet/release'
111
+
112
+ async function task() {
113
+ await doSomething1()
114
+ await doSomething2()
115
+ }
116
+
117
+ release({ task })
118
+ ```
119
+
120
+ #### 类型
121
+
122
+ ```ts
123
+ function publish(preRelease: boolean | undefined): Promise<void>
124
+ function updateVersion(version: string): void
125
+ interface ReleaseCommandOptions {
126
+ remote?: string
127
+ skipNpmPublish?: boolean
128
+ skipGitTag?: boolean
129
+ task?(): Promise<void>
130
+ }
131
+ function release(options: ReleaseCommandOptions): Promise<void>
132
+
133
+ interface ChangelogCommandOptions {
134
+ file?: string
135
+ releaseCount?: number
136
+ }
137
+ function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
138
+
139
+ const COMMIT_MESSAGE_RE: RegExp
140
+ function isVersionCommitMessage(message: string): string | false | null
141
+ function getCommitMessage(commitMessagePath: string): string
142
+ interface CommitLintCommandOptions {
143
+ commitMessagePath: string
144
+ commitMessageRe?: string | RegExp
145
+ errorMessage?: string
146
+ warningMessage?: string
147
+ }
148
+ function commitLint(options: CommitLintCommandOptions): void
149
+ ```
150
+
151
+ ## License
152
+
153
+ [MIT](https://github.com/varletjs/release/blob/main/LICENSE)
package/bin/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { release, changelog, commitLint } from '../dist/index.js'
2
+ import { release, publish, changelog, commitLint } from '../dist/index.js'
3
3
  import { Command } from 'commander'
4
4
 
5
5
  const program = new Command()
@@ -7,9 +7,16 @@ const program = new Command()
7
7
  program
8
8
  .command('release')
9
9
  .option('-r --remote <remote>', 'Remote name')
10
+ .option('-s --skip-npm-publish', 'Skip npm publish')
11
+ .option('-sgt --skip-git-tag', 'Skip git tag')
10
12
  .description('Release all packages and generate changelogs')
11
13
  .action(async (options) => release(options))
12
14
 
15
+ program
16
+ .command('publish')
17
+ .description('Publish to npm')
18
+ .action(async () => publish())
19
+
13
20
  program
14
21
  .command('changelog')
15
22
  .option('-rc --releaseCount <releaseCount>', 'Release count')
package/dist/index.cjs CHANGED
@@ -35,7 +35,9 @@ __export(src_exports, {
35
35
  commitLint: () => commitLint,
36
36
  getCommitMessage: () => getCommitMessage,
37
37
  isVersionCommitMessage: () => isVersionCommitMessage,
38
- release: () => release
38
+ publish: () => publish,
39
+ release: () => release,
40
+ updateVersion: () => updateVersion
39
41
  });
40
42
  module.exports = __toCommonJS(src_exports);
41
43
 
@@ -112,11 +114,13 @@ async function publish(preRelease) {
112
114
  ret.stdout && logger_default.info(ret.stdout);
113
115
  }
114
116
  }
115
- async function pushGit(version, remote = "origin") {
117
+ async function pushGit(version, remote = "origin", skipGitTag = false) {
116
118
  const s = (0, import_nanospinner2.createSpinner)("Pushing to remote git repository").start();
117
119
  await (0, import_execa.execa)("git", ["add", "."]);
118
120
  await (0, import_execa.execa)("git", ["commit", "-m", `v${version}`]);
119
- await (0, import_execa.execa)("git", ["tag", `v${version}`]);
121
+ if (!skipGitTag) {
122
+ await (0, import_execa.execa)("git", ["tag", `v${version}`]);
123
+ }
120
124
  await (0, import_execa.execa)("git", ["push", remote, `v${version}`]);
121
125
  const ret = await (0, import_execa.execa)("git", ["push"]);
122
126
  s.success({ text: "Push remote repository successfully" });
@@ -209,10 +213,12 @@ async function release(options) {
209
213
  if (options.task) {
210
214
  await options.task();
211
215
  }
212
- await publish(isPreRelease);
216
+ if (!options.skipNpmPublish) {
217
+ await publish(isPreRelease);
218
+ }
213
219
  if (!isPreRelease) {
214
220
  await changelog();
215
- await pushGit(expectVersion, options.remote);
221
+ await pushGit(expectVersion, options.remote, options.skipGitTag);
216
222
  }
217
223
  logger_default.success(`Release version ${expectVersion} successfully!`);
218
224
  if (isPreRelease) {
@@ -294,5 +300,7 @@ function commitLint(options) {
294
300
  commitLint,
295
301
  getCommitMessage,
296
302
  isVersionCommitMessage,
297
- release
303
+ publish,
304
+ release,
305
+ updateVersion
298
306
  });
package/dist/index.d.cts CHANGED
@@ -1,5 +1,9 @@
1
+ declare function publish(preRelease: boolean | undefined): Promise<void>;
2
+ declare function updateVersion(version: string): void;
1
3
  interface ReleaseCommandOptions {
2
4
  remote?: string;
5
+ skipNpmPublish?: boolean;
6
+ skipGitTag?: boolean;
3
7
  task?(): Promise<void>;
4
8
  }
5
9
  declare function release(options: ReleaseCommandOptions): Promise<void>;
@@ -21,4 +25,4 @@ interface CommitLintCommandOptions {
21
25
  }
22
26
  declare function commitLint(options: CommitLintCommandOptions): void;
23
27
 
24
- export { COMMIT_MESSAGE_RE, type ChangelogCommandOptions, type CommitLintCommandOptions, type ReleaseCommandOptions, changelog, commitLint, getCommitMessage, isVersionCommitMessage, release };
28
+ export { COMMIT_MESSAGE_RE, type ChangelogCommandOptions, type CommitLintCommandOptions, type ReleaseCommandOptions, changelog, commitLint, getCommitMessage, isVersionCommitMessage, publish, release, updateVersion };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
+ declare function publish(preRelease: boolean | undefined): Promise<void>;
2
+ declare function updateVersion(version: string): void;
1
3
  interface ReleaseCommandOptions {
2
4
  remote?: string;
5
+ skipNpmPublish?: boolean;
6
+ skipGitTag?: boolean;
3
7
  task?(): Promise<void>;
4
8
  }
5
9
  declare function release(options: ReleaseCommandOptions): Promise<void>;
@@ -21,4 +25,4 @@ interface CommitLintCommandOptions {
21
25
  }
22
26
  declare function commitLint(options: CommitLintCommandOptions): void;
23
27
 
24
- export { COMMIT_MESSAGE_RE, type ChangelogCommandOptions, type CommitLintCommandOptions, type ReleaseCommandOptions, changelog, commitLint, getCommitMessage, isVersionCommitMessage, release };
28
+ export { COMMIT_MESSAGE_RE, type ChangelogCommandOptions, type CommitLintCommandOptions, type ReleaseCommandOptions, changelog, commitLint, getCommitMessage, isVersionCommitMessage, publish, release, updateVersion };
package/dist/index.js CHANGED
@@ -71,11 +71,13 @@ async function publish(preRelease) {
71
71
  ret.stdout && logger_default.info(ret.stdout);
72
72
  }
73
73
  }
74
- async function pushGit(version, remote = "origin") {
74
+ async function pushGit(version, remote = "origin", skipGitTag = false) {
75
75
  const s = createSpinner2("Pushing to remote git repository").start();
76
76
  await execa("git", ["add", "."]);
77
77
  await execa("git", ["commit", "-m", `v${version}`]);
78
- await execa("git", ["tag", `v${version}`]);
78
+ if (!skipGitTag) {
79
+ await execa("git", ["tag", `v${version}`]);
80
+ }
79
81
  await execa("git", ["push", remote, `v${version}`]);
80
82
  const ret = await execa("git", ["push"]);
81
83
  s.success({ text: "Push remote repository successfully" });
@@ -168,10 +170,12 @@ async function release(options) {
168
170
  if (options.task) {
169
171
  await options.task();
170
172
  }
171
- await publish(isPreRelease);
173
+ if (!options.skipNpmPublish) {
174
+ await publish(isPreRelease);
175
+ }
172
176
  if (!isPreRelease) {
173
177
  await changelog();
174
- await pushGit(expectVersion, options.remote);
178
+ await pushGit(expectVersion, options.remote, options.skipGitTag);
175
179
  }
176
180
  logger_default.success(`Release version ${expectVersion} successfully!`);
177
181
  if (isPreRelease) {
@@ -252,5 +256,7 @@ export {
252
256
  commitLint,
253
257
  getCommitMessage,
254
258
  isVersionCommitMessage,
255
- release
259
+ publish,
260
+ release,
261
+ updateVersion
256
262
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@varlet/release",
3
3
  "type": "module",
4
- "version": "0.1.2",
4
+ "version": "0.2.1",
5
5
  "description": "release all packages and generate changelogs",
6
6
  "keywords": [
7
7
  "varlet",