Skip to content

Commit 75e84c7

Browse files
committed
feat: show progress during release
1 parent bf1935e commit 75e84c7

2 files changed

Lines changed: 45 additions & 1 deletion

File tree

src/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Config, Context, OverrideConfig, UserConfig } from "./types";
2+
import { progress } from "./utils/progress";
23
import { dateFormat } from "./utils/string";
34
import { loadConfig as c12 } from "c12";
45
import fs from "fs-extra";
@@ -137,12 +138,14 @@ const defaultConfig = {
137138
release: {
138139
bumpp: {
139140
release: "prompt",
141+
confirm: true,
140142
preid: "beta",
141143
// execute: "npm run build",
142144
all: false,
143-
commit: "Release v%s",
145+
commit: "chore(publish): release v%s",
144146
tag: "v%s",
145147
push: true,
148+
progress: progress,
146149
},
147150
},
148151
logLevel: "info",

src/utils/progress.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { ProgressEvent, VersionBumpProgress } from "bumpp";
2+
import consola from "consola";
3+
4+
/**
5+
* bumpp 显示进度的回调
6+
*
7+
* @see https://github.com/antfu/bumpp/blob/main/src/cli/index.ts
8+
*/
9+
export function progress({
10+
event,
11+
script,
12+
updatedFiles,
13+
skippedFiles,
14+
newVersion,
15+
}: VersionBumpProgress): void {
16+
switch (event) {
17+
case ProgressEvent.FileUpdated:
18+
consola.success(`Updated ${updatedFiles.pop()} to ${newVersion}`);
19+
break;
20+
21+
case ProgressEvent.FileSkipped:
22+
consola.info(`${skippedFiles.pop()} did not need to be updated`);
23+
break;
24+
25+
case ProgressEvent.GitCommit:
26+
consola.success("Git commit");
27+
break;
28+
29+
case ProgressEvent.GitTag:
30+
consola.success("Git tag");
31+
break;
32+
33+
case ProgressEvent.GitPush:
34+
consola.success("Git push");
35+
break;
36+
37+
case ProgressEvent.NpmScript:
38+
consola.success(`Npm run ${script}`);
39+
break;
40+
}
41+
}

0 commit comments

Comments
 (0)