@varlet/release 0.4.4 → 1.0.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/README.md +163 -161
- package/README.zh-CN.md +163 -161
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +19 -0
- package/dist/index.d.ts +39 -26
- package/dist/index.js +287 -299
- package/package.json +36 -33
- package/bin/index.js +0 -47
- package/dist/index.cjs +0 -409
- package/dist/index.d.cts +0 -41
package/README.zh-CN.md
CHANGED
|
@@ -1,161 +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` 的工具,依赖于 `pnpm`。
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
#
|
|
33
|
-
npx vr release
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
#
|
|
41
|
-
npx vr changelog
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
| -
|
|
59
|
-
| -
|
|
60
|
-
| -
|
|
61
|
-
| -
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
| -
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
| -
|
|
78
|
-
| -
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
| '
|
|
138
|
-
| '
|
|
139
|
-
| '
|
|
140
|
-
| '
|
|
141
|
-
| '
|
|
142
|
-
| '
|
|
143
|
-
| '
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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
|
+
`Varlet Release` 需要 `Node.js` ^20.19.0 || >=22.12.0,并且仅支持 `esm`。
|
|
17
|
+
|
|
18
|
+
## 安装
|
|
19
|
+
|
|
20
|
+
```shell
|
|
21
|
+
pnpm add @varlet/release -D
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 使用
|
|
25
|
+
|
|
26
|
+
### 使用命令
|
|
27
|
+
|
|
28
|
+
```shell
|
|
29
|
+
# 发布所有包并生成变更日志
|
|
30
|
+
npx vr release
|
|
31
|
+
|
|
32
|
+
# 指定远程仓库名称
|
|
33
|
+
npx vr release -r https://github.com/varletjs/varlet-release
|
|
34
|
+
# or
|
|
35
|
+
npx vr release --remote https://github.com/varletjs/varlet-release
|
|
36
|
+
|
|
37
|
+
# 仅生成变更日志
|
|
38
|
+
npx vr changelog
|
|
39
|
+
|
|
40
|
+
# 指定变更日志文件名
|
|
41
|
+
npx vr changelog -f changelog.md
|
|
42
|
+
# or
|
|
43
|
+
npx vr changelog --file changelog.md
|
|
44
|
+
|
|
45
|
+
# 检测 commit message
|
|
46
|
+
npx vr lint-commit -p .git/COMMIT_EDITMSG
|
|
47
|
+
|
|
48
|
+
# 发布到 npm,可以在 ci 中执行
|
|
49
|
+
npx vr publish
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 配置
|
|
53
|
+
|
|
54
|
+
#### release
|
|
55
|
+
|
|
56
|
+
| 参数 | 说明 |
|
|
57
|
+
| ------------------------- | ----------------------------------------------------------------------- |
|
|
58
|
+
| -r --remote \<remote\> | 指定远程仓库名称 |
|
|
59
|
+
| -s --skip-npm-publish | 跳过 npm 发布 |
|
|
60
|
+
| -c --check-remote-version | 检测 npm 包的远程版本是否与要在本地发布的包版本相同,如果是,则停止执行 |
|
|
61
|
+
| -sc --skip-changelog | 跳过生成变更日志 |
|
|
62
|
+
| -sgt --skip-git-tag | 跳过 git tag |
|
|
63
|
+
| -nt --npm-tag \<npmTag\> | npm tag |
|
|
64
|
+
|
|
65
|
+
#### changelog
|
|
66
|
+
|
|
67
|
+
| 参数 | 说明 |
|
|
68
|
+
| ----------------------------------- | ------------------ |
|
|
69
|
+
| -f --file \<filename\> | 指定变更日志文件名 |
|
|
70
|
+
| -rc --releaseCount \<releaseCount\> | 发布数量 |
|
|
71
|
+
| -p --preset \<preset\> | 指定变更预设 |
|
|
72
|
+
|
|
73
|
+
#### lint-commit
|
|
74
|
+
|
|
75
|
+
| 参数 | 说明 |
|
|
76
|
+
| ------------------------------- | --------------------------------------------------------------------------- |
|
|
77
|
+
| -p --commitMessagePath \<path\> | 提交 `git message` 的临时文件路径。`git` 钩子 `commit-msg` 会传递这个参数。 |
|
|
78
|
+
| -r --commitMessageRe \<reg\> | 验证 `commit message` 是否通过的正则 |
|
|
79
|
+
| -e --errorMessage \<message\> | 验证失败展示的错误信息 |
|
|
80
|
+
| -w --warningMessage \<message\> | 验证失败展示的提示信息 |
|
|
81
|
+
|
|
82
|
+
#### publish
|
|
83
|
+
|
|
84
|
+
| 参数 | 说明 |
|
|
85
|
+
| ------------------------- | --------------------------------------------------------------------- |
|
|
86
|
+
| -c --check-remote-version | 检测npm包的远程版本是否与要在本地发布的包版本相同,如果是,则跳过发布 |
|
|
87
|
+
| -nt --npm-tag \<npmTag\> | npm tag |
|
|
88
|
+
|
|
89
|
+
### 自定义处理
|
|
90
|
+
|
|
91
|
+
#### 示例
|
|
92
|
+
|
|
93
|
+
```js
|
|
94
|
+
import { changelog, release } from '@varlet/release'
|
|
95
|
+
|
|
96
|
+
// Do what you want to do...
|
|
97
|
+
release()
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
你可以传入一个 `task`,在包版本更改后,在发布之前会调用 `task`。
|
|
101
|
+
|
|
102
|
+
```js
|
|
103
|
+
import { changelog, release } from '@varlet/release'
|
|
104
|
+
|
|
105
|
+
async function task() {
|
|
106
|
+
await doSomething1()
|
|
107
|
+
await doSomething2()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
release({ task })
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
#### 类型
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
interface PublishCommandOptions {
|
|
117
|
+
preRelease?: boolean
|
|
118
|
+
checkRemoteVersion?: boolean
|
|
119
|
+
npmTag?: string
|
|
120
|
+
}
|
|
121
|
+
function publish({ preRelease, checkRemoteVersion, npmTag }: PublishCommandOptions): Promise<void>
|
|
122
|
+
function updateVersion(version: string): void
|
|
123
|
+
interface ReleaseCommandOptions {
|
|
124
|
+
remote?: string
|
|
125
|
+
skipNpmPublish?: boolean
|
|
126
|
+
skipChangelog?: boolean
|
|
127
|
+
skipGitTag?: boolean
|
|
128
|
+
npmTag?: string
|
|
129
|
+
task?(newVersion: string, oldVersion: string): Promise<void>
|
|
130
|
+
}
|
|
131
|
+
function release(options: ReleaseCommandOptions): Promise<void>
|
|
132
|
+
|
|
133
|
+
interface ChangelogCommandOptions {
|
|
134
|
+
file?: string
|
|
135
|
+
releaseCount?: number
|
|
136
|
+
preset?:
|
|
137
|
+
| 'angular'
|
|
138
|
+
| 'atom'
|
|
139
|
+
| 'codemirror'
|
|
140
|
+
| 'conventionalcommits'
|
|
141
|
+
| 'ember'
|
|
142
|
+
| 'eslint'
|
|
143
|
+
| 'express'
|
|
144
|
+
| 'jquery'
|
|
145
|
+
| 'jshint'
|
|
146
|
+
}
|
|
147
|
+
function changelog({ releaseCount, file, preset }?: 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
|
+
## 许可证
|
|
162
|
+
|
|
163
|
+
[MIT](https://github.com/varletjs/release/blob/main/LICENSE)
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { changelog, commitLint, publish, release } from "./index.js";
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
|
|
5
|
+
//#region package.json
|
|
6
|
+
var version = "1.0.1";
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/cli.ts
|
|
10
|
+
const program = new Command();
|
|
11
|
+
program.version(version);
|
|
12
|
+
program.command("release").option("-r --remote <remote>", "Remote name").option("-s --skip-npm-publish", "Skip npm publish").option("-sc --skip-changelog", "Skip generate changelog").option("-sgt --skip-git-tag", "Skip git tag").option("-nt --npm-tag <npmTag>", "Npm tag").option("-c --check-remote-version", "Check remote version").description("Release all packages and generate changelogs").action((options) => release(options));
|
|
13
|
+
program.command("publish").option("-c --check-remote-version", "Check remote version").option("-nt --npm-tag <npmTag>", "Npm tag").description("Publish to npm").action((options) => publish(options));
|
|
14
|
+
program.command("changelog").option("-rc --releaseCount <releaseCount>", "Release count").option("-f --file <file>", "Changelog filename").option("-p --preset <preset>", "Changelog preset").description("Generate changelog").action((options) => changelog(options));
|
|
15
|
+
program.command("commit-lint").option("-p --commitMessagePath <path>", "Git commit message path").option("-r --commitMessageRe <reg>", "Validate the regular of whether the commit message passes").option("-e --errorMessage <message>", "Validation failed to display error messages").option("-w --warningMessage <message>", "Validation failed to display warning messages").description("Lint commit message").action((option) => commitLint(option));
|
|
16
|
+
program.parse();
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,41 +1,54 @@
|
|
|
1
|
-
import conventionalChangelog from
|
|
1
|
+
import conventionalChangelog from "conventional-changelog";
|
|
2
2
|
|
|
3
|
+
//#region src/release.d.ts
|
|
3
4
|
declare function isSameVersion(version?: string): Promise<boolean | undefined>;
|
|
4
5
|
interface PublishCommandOptions {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
preRelease?: boolean;
|
|
7
|
+
checkRemoteVersion?: boolean;
|
|
8
|
+
npmTag?: string;
|
|
8
9
|
}
|
|
9
|
-
declare function publish({
|
|
10
|
+
declare function publish({
|
|
11
|
+
preRelease,
|
|
12
|
+
checkRemoteVersion,
|
|
13
|
+
npmTag
|
|
14
|
+
}: PublishCommandOptions): Promise<void>;
|
|
15
|
+
declare function getAllPackageJsons(): string[];
|
|
10
16
|
declare function updateVersion(version: string): void;
|
|
11
17
|
interface ReleaseCommandOptions {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
remote?: string;
|
|
19
|
+
npmTag?: string;
|
|
20
|
+
skipNpmPublish?: boolean;
|
|
21
|
+
skipChangelog?: boolean;
|
|
22
|
+
skipGitTag?: boolean;
|
|
23
|
+
checkRemoteVersion?: boolean;
|
|
24
|
+
task?(newVersion: string, oldVersion: string): Promise<void>;
|
|
19
25
|
}
|
|
20
26
|
declare function release(options: ReleaseCommandOptions): Promise<void>;
|
|
21
|
-
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/changelog.d.ts
|
|
22
29
|
interface ChangelogCommandOptions {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
file?: string;
|
|
31
|
+
releaseCount?: number;
|
|
32
|
+
preset?: "angular" | "atom" | "codemirror" | "conventionalcommits" | "ember" | "eslint" | "express" | "jquery" | "jshint";
|
|
33
|
+
writerOpts?: Parameters<typeof conventionalChangelog>["4"];
|
|
27
34
|
}
|
|
28
|
-
declare function changelog({
|
|
29
|
-
|
|
35
|
+
declare function changelog({
|
|
36
|
+
releaseCount,
|
|
37
|
+
file,
|
|
38
|
+
preset,
|
|
39
|
+
writerOpts
|
|
40
|
+
}?: ChangelogCommandOptions): Promise<void>;
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/commitLint.d.ts
|
|
30
43
|
declare const COMMIT_MESSAGE_RE: RegExp;
|
|
31
|
-
declare function isVersionCommitMessage(message: string):
|
|
44
|
+
declare function isVersionCommitMessage(message: string): boolean;
|
|
32
45
|
declare function getCommitMessage(commitMessagePath: string): string;
|
|
33
46
|
interface CommitLintCommandOptions {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
47
|
+
commitMessagePath: string;
|
|
48
|
+
commitMessageRe?: string | RegExp;
|
|
49
|
+
errorMessage?: string;
|
|
50
|
+
warningMessage?: string;
|
|
38
51
|
}
|
|
39
52
|
declare function commitLint(options: CommitLintCommandOptions): void;
|
|
40
|
-
|
|
41
|
-
export { COMMIT_MESSAGE_RE,
|
|
53
|
+
//#endregion
|
|
54
|
+
export { COMMIT_MESSAGE_RE, ChangelogCommandOptions, CommitLintCommandOptions, PublishCommandOptions, ReleaseCommandOptions, changelog, commitLint, getAllPackageJsons, getCommitMessage, isSameVersion, isVersionCommitMessage, publish, release, updateVersion };
|