Skip to content

Commit a086c0c

Browse files
Show the progress of the bump command as it completes steps
1 parent 7abd3fa commit a086c0c

3 files changed

Lines changed: 31 additions & 1 deletion

File tree

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"@types/detect-newline": "^2.1.0",
5454
"@types/globby": "^8.0.0",
5555
"@types/inquirer": "0.0.43",
56+
"@types/log-symbols": "^2.0.0",
5657
"@types/mocha": "^5.2.6",
5758
"@types/node": "^11.9.5",
5859
"@types/semver": "^5.5.0",

src/cli/index.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// tslint:disable: no-console
2+
import { success } from "log-symbols";
23
import { manifest } from "../manifest";
34
import { versionBump } from "../version-bump";
45
import { VersionBumpOptions } from "../version-bump-options";
6+
import { ProgressEvent, VersionBumpProgress } from "../version-bump-progress";
57
import { helpText } from "./help";
68
import { parseArgs } from "./parse-args";
79

@@ -14,7 +16,6 @@ enum ExitCode {
1416
InvalidArgument = 9,
1517
}
1618

17-
1819
/**
1920
* The main entry point of the CLI
2021
*
@@ -53,13 +54,35 @@ export async function main(args: string[]): Promise<void> {
5354

5455
async function bump(options: VersionBumpOptions): Promise<void> {
5556
try {
57+
options.progress = progress;
5658
await versionBump(options);
5759
}
5860
catch (error) {
5961
errorHandler(error as Error);
6062
}
6163
}
6264

65+
function progress({ event, files, newVersion }: VersionBumpProgress): void {
66+
// tslint:disable-next-line: switch-default
67+
switch (event) {
68+
case ProgressEvent.FileUpdated:
69+
console.log(success, `Updated ${files.pop()} to ${newVersion}`);
70+
break;
71+
72+
case ProgressEvent.GitCommit:
73+
console.log(success, "Git commit");
74+
break;
75+
76+
case ProgressEvent.GitTag:
77+
console.log(success, "Git tag");
78+
break;
79+
80+
case ProgressEvent.GitPush:
81+
console.log(success, "Git push");
82+
break;
83+
}
84+
}
85+
6386

6487
function errorHandler(error: Error): void {
6588
let message = error.message || String(error);

0 commit comments

Comments
 (0)