@varlet/release 0.1.1 → 0.2.0
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 +16 -0
- package/README.zh-CN.md +16 -0
- package/bin/index.js +35 -29
- package/dist/index.cjs +9 -3
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +6 -2
- package/package.json +1 -3
package/README.md
CHANGED
|
@@ -56,6 +56,9 @@ npx vr changelog --file changelog.md
|
|
|
56
56
|
|
|
57
57
|
# Lint commit message
|
|
58
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
|
|
59
62
|
```
|
|
60
63
|
|
|
61
64
|
### Configuration
|
|
@@ -71,6 +74,7 @@ npx vr lint-commit -p .git/COMMIT_EDITMSG
|
|
|
71
74
|
| Params | Instructions |
|
|
72
75
|
| ----------------------------------- | -------------------------- |
|
|
73
76
|
| -f --file \<filename\> | Specify changelog filename |
|
|
77
|
+
| -s --skip-npm-publish | Skip npm publish |
|
|
74
78
|
| -rc --releaseCount \<releaseCount\> | Release count |
|
|
75
79
|
|
|
76
80
|
#### lint-commit
|
|
@@ -82,6 +86,12 @@ npx vr lint-commit -p .git/COMMIT_EDITMSG
|
|
|
82
86
|
| -e --errorMessage \<message\> | Validation failed to display error messages |
|
|
83
87
|
| -w --warningMessage \<message\> | Validation failed to display warning messages |
|
|
84
88
|
|
|
89
|
+
#### publish
|
|
90
|
+
|
|
91
|
+
```shell
|
|
92
|
+
vr publish
|
|
93
|
+
```
|
|
94
|
+
|
|
85
95
|
### Custom Handle
|
|
86
96
|
|
|
87
97
|
#### Example
|
|
@@ -109,8 +119,11 @@ release({ task })
|
|
|
109
119
|
#### Types
|
|
110
120
|
|
|
111
121
|
```ts
|
|
122
|
+
function publish(preRelease: boolean | undefined): Promise<void>
|
|
123
|
+
function updateVersion(version: string): void
|
|
112
124
|
interface ReleaseCommandOptions {
|
|
113
125
|
remote?: string
|
|
126
|
+
skipNpmPublish?: boolean
|
|
114
127
|
task?(): Promise<void>
|
|
115
128
|
}
|
|
116
129
|
function release(options: ReleaseCommandOptions): Promise<void>
|
|
@@ -121,6 +134,9 @@ interface ChangelogCommandOptions {
|
|
|
121
134
|
}
|
|
122
135
|
function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
|
|
123
136
|
|
|
137
|
+
const COMMIT_MESSAGE_RE: RegExp
|
|
138
|
+
function isVersionCommitMessage(message: string): string | false | null
|
|
139
|
+
function getCommitMessage(commitMessagePath: string): string
|
|
124
140
|
interface CommitLintCommandOptions {
|
|
125
141
|
commitMessagePath: string
|
|
126
142
|
commitMessageRe?: string | RegExp
|
package/README.zh-CN.md
CHANGED
|
@@ -56,6 +56,9 @@ npx vr changelog --file changelog.md
|
|
|
56
56
|
|
|
57
57
|
# 检测 commit message
|
|
58
58
|
npx vr lint-commit -p .git/COMMIT_EDITMSG
|
|
59
|
+
|
|
60
|
+
# 发布到 npm,可以在 ci 中执行
|
|
61
|
+
npx vr publish
|
|
59
62
|
```
|
|
60
63
|
|
|
61
64
|
### 配置
|
|
@@ -71,6 +74,7 @@ npx vr lint-commit -p .git/COMMIT_EDITMSG
|
|
|
71
74
|
| 参数 | 说明 |
|
|
72
75
|
| ----------------------------------- | ------------------ |
|
|
73
76
|
| -f --file \<filename\> | 指定变更日志文件名 |
|
|
77
|
+
| -s --skip-npm-publish | 跳过 npm 发布 |
|
|
74
78
|
| -rc --releaseCount \<releaseCount\> | 发布数量 |
|
|
75
79
|
|
|
76
80
|
#### lint-commit
|
|
@@ -82,6 +86,12 @@ npx vr lint-commit -p .git/COMMIT_EDITMSG
|
|
|
82
86
|
| -e --errorMessage \<message\> | 验证失败展示的错误信息 |
|
|
83
87
|
| -w --warningMessage \<message\> | 验证失败展示的提示信息 |
|
|
84
88
|
|
|
89
|
+
#### publish
|
|
90
|
+
|
|
91
|
+
```shell
|
|
92
|
+
vr publish
|
|
93
|
+
```
|
|
94
|
+
|
|
85
95
|
### 自定义处理
|
|
86
96
|
|
|
87
97
|
#### 示例
|
|
@@ -109,8 +119,11 @@ release({ task })
|
|
|
109
119
|
#### 类型
|
|
110
120
|
|
|
111
121
|
```ts
|
|
122
|
+
function publish(preRelease: boolean | undefined): Promise<void>
|
|
123
|
+
function updateVersion(version: string): void
|
|
112
124
|
interface ReleaseCommandOptions {
|
|
113
125
|
remote?: string
|
|
126
|
+
skipNpmPublish?: boolean
|
|
114
127
|
task?(): Promise<void>
|
|
115
128
|
}
|
|
116
129
|
function release(options: ReleaseCommandOptions): Promise<void>
|
|
@@ -121,6 +134,9 @@ interface ChangelogCommandOptions {
|
|
|
121
134
|
}
|
|
122
135
|
function changelog({ releaseCount, file }?: ChangelogCommandOptions): Promise<void>
|
|
123
136
|
|
|
137
|
+
const COMMIT_MESSAGE_RE: RegExp
|
|
138
|
+
function isVersionCommitMessage(message: string): string | false | null
|
|
139
|
+
function getCommitMessage(commitMessagePath: string): string
|
|
124
140
|
interface CommitLintCommandOptions {
|
|
125
141
|
commitMessagePath: string
|
|
126
142
|
commitMessageRe?: string | RegExp
|
package/bin/index.js
CHANGED
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { release, 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
|
-
.
|
|
11
|
-
.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
.
|
|
16
|
-
.
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
.
|
|
22
|
-
.option('-
|
|
23
|
-
.
|
|
24
|
-
.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.
|
|
28
|
-
|
|
29
|
-
|
|
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
|
+
.description('Release all packages and generate changelogs')
|
|
12
|
+
.action(async (options) => release(options))
|
|
13
|
+
|
|
14
|
+
program
|
|
15
|
+
.command('publish')
|
|
16
|
+
.description('Publish to npm')
|
|
17
|
+
.action(async () => publish())
|
|
18
|
+
|
|
19
|
+
program
|
|
20
|
+
.command('changelog')
|
|
21
|
+
.option('-rc --releaseCount <releaseCount>', 'Release count')
|
|
22
|
+
.option('-f --file <file>', 'Changelog filename')
|
|
23
|
+
.description('Generate changelog')
|
|
24
|
+
.action(async (options) => changelog(options))
|
|
25
|
+
|
|
26
|
+
program
|
|
27
|
+
.command('commit-lint')
|
|
28
|
+
.option('-p --commitMessagePath <path>', 'Git commit message path')
|
|
29
|
+
.option('-r --commitMessageRe <reg>', 'Validate the regular of whether the commit message passes')
|
|
30
|
+
.option('-e --errorMessage <message>', 'Validation failed to display error messages')
|
|
31
|
+
.option('-w --warningMessage <message>', 'Validation failed to display warning messages')
|
|
32
|
+
.description('Lint commit message')
|
|
33
|
+
.action(async (option) => commitLint(option))
|
|
34
|
+
|
|
35
|
+
program.parse()
|
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
|
-
|
|
38
|
+
publish: () => publish,
|
|
39
|
+
release: () => release,
|
|
40
|
+
updateVersion: () => updateVersion
|
|
39
41
|
});
|
|
40
42
|
module.exports = __toCommonJS(src_exports);
|
|
41
43
|
|
|
@@ -209,7 +211,9 @@ async function release(options) {
|
|
|
209
211
|
if (options.task) {
|
|
210
212
|
await options.task();
|
|
211
213
|
}
|
|
212
|
-
|
|
214
|
+
if (!options.skipNpmPublish) {
|
|
215
|
+
await publish(isPreRelease);
|
|
216
|
+
}
|
|
213
217
|
if (!isPreRelease) {
|
|
214
218
|
await changelog();
|
|
215
219
|
await pushGit(expectVersion, options.remote);
|
|
@@ -294,5 +298,7 @@ function commitLint(options) {
|
|
|
294
298
|
commitLint,
|
|
295
299
|
getCommitMessage,
|
|
296
300
|
isVersionCommitMessage,
|
|
297
|
-
|
|
301
|
+
publish,
|
|
302
|
+
release,
|
|
303
|
+
updateVersion
|
|
298
304
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
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;
|
|
3
6
|
task?(): Promise<void>;
|
|
4
7
|
}
|
|
5
8
|
declare function release(options: ReleaseCommandOptions): Promise<void>;
|
|
@@ -21,4 +24,4 @@ interface CommitLintCommandOptions {
|
|
|
21
24
|
}
|
|
22
25
|
declare function commitLint(options: CommitLintCommandOptions): void;
|
|
23
26
|
|
|
24
|
-
export { COMMIT_MESSAGE_RE, type ChangelogCommandOptions, type CommitLintCommandOptions, type ReleaseCommandOptions, changelog, commitLint, getCommitMessage, isVersionCommitMessage, release };
|
|
27
|
+
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,8 @@
|
|
|
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;
|
|
3
6
|
task?(): Promise<void>;
|
|
4
7
|
}
|
|
5
8
|
declare function release(options: ReleaseCommandOptions): Promise<void>;
|
|
@@ -21,4 +24,4 @@ interface CommitLintCommandOptions {
|
|
|
21
24
|
}
|
|
22
25
|
declare function commitLint(options: CommitLintCommandOptions): void;
|
|
23
26
|
|
|
24
|
-
export { COMMIT_MESSAGE_RE, type ChangelogCommandOptions, type CommitLintCommandOptions, type ReleaseCommandOptions, changelog, commitLint, getCommitMessage, isVersionCommitMessage, release };
|
|
27
|
+
export { COMMIT_MESSAGE_RE, type ChangelogCommandOptions, type CommitLintCommandOptions, type ReleaseCommandOptions, changelog, commitLint, getCommitMessage, isVersionCommitMessage, publish, release, updateVersion };
|
package/dist/index.js
CHANGED
|
@@ -168,7 +168,9 @@ async function release(options) {
|
|
|
168
168
|
if (options.task) {
|
|
169
169
|
await options.task();
|
|
170
170
|
}
|
|
171
|
-
|
|
171
|
+
if (!options.skipNpmPublish) {
|
|
172
|
+
await publish(isPreRelease);
|
|
173
|
+
}
|
|
172
174
|
if (!isPreRelease) {
|
|
173
175
|
await changelog();
|
|
174
176
|
await pushGit(expectVersion, options.remote);
|
|
@@ -252,5 +254,7 @@ export {
|
|
|
252
254
|
commitLint,
|
|
253
255
|
getCommitMessage,
|
|
254
256
|
isVersionCommitMessage,
|
|
255
|
-
|
|
257
|
+
publish,
|
|
258
|
+
release,
|
|
259
|
+
updateVersion
|
|
256
260
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/release",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"description": "release all packages and generate changelogs",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"varlet",
|
|
@@ -71,8 +71,6 @@
|
|
|
71
71
|
"semver": "^7.5.4"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
|
-
"preinstall": "npx only-allow pnpm",
|
|
75
|
-
"postinstall": "node -e \"if (process.env.INIT_CWD === process.cwd()) { process.exit(1) }\" || simple-git-hooks",
|
|
76
74
|
"dev": "tsup --watch",
|
|
77
75
|
"build": "tsup",
|
|
78
76
|
"release": "pnpm build && node bin/index.js release",
|