From eb2bd5af7402c2b8051c042e2a9a338fced25901 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 7 Sep 2021 12:15:53 +0800 Subject: [PATCH] feat: new --execute arg --- README.md | 16 ++++++++++++++++ src/cli/help.ts | 2 ++ src/cli/parse-args.ts | 2 ++ src/normalize-options.ts | 4 +++- src/types/version-bump-options.ts | 6 ++++++ src/version-bump.ts | 5 +++++ 6 files changed, 34 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d2c7436..236d806 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ +# bumpp + +[![NPM version](https://img.shields.io/npm/v/bumpp?color=a1b858&label=)](https://www.npmjs.com/package/bumpp) + +Forked from [`version-bump-prompt`](https://github.com/JS-DevTools/version-bump-prompt) + +###### Changes in this fork + +- Renamed to `bumpp` - so you can use `npx bumpp` directly +- Add a new argument `--execute` to execute the command before committing + +
+Original README + # Version Bump Prompt [![Cross-Platform Compatibility](https://jstools.dev/img/badges/os-badges.svg)](https://github.com/JS-DevTools/version-bump-prompt/actions) @@ -265,3 +279,5 @@ Thanks to these awesome companies for their support of Open Source developers [![Coveralls](https://jstools.dev/img/badges/coveralls.svg)](https://coveralls.io) [![Travis CI](https://jstools.dev/img/badges/travis-ci.svg)](https://travis-ci.com) [![SauceLabs](https://jstools.dev/img/badges/sauce-labs.svg)](https://saucelabs.com) + +
diff --git a/src/cli/help.ts b/src/cli/help.ts index 2f097b4..9895481 100644 --- a/src/cli/help.ts +++ b/src/cli/help.ts @@ -39,6 +39,8 @@ options: -v, --version Show the version number + -x, --execute Excute additional command after bumping and before commiting + -q, --quiet Suppress unnecessary output -h, --help Show usage information diff --git a/src/cli/parse-args.ts b/src/cli/parse-args.ts index 27d8810..a453127 100644 --- a/src/cli/parse-args.ts +++ b/src/cli/parse-args.ts @@ -32,6 +32,7 @@ export function parseArgs(argv: string[]): ParsedArgs { { name: "version", alias: "v", type: Boolean }, { name: "help", alias: "h", type: Boolean }, { name: "ignore-scripts", type: Boolean }, + { name: "execute", alias: "x", type: String }, { name: "files", type: String, multiple: true, defaultOption: true }, ], { argv } @@ -50,6 +51,7 @@ export function parseArgs(argv: string[]): ParsedArgs { noVerify: args["no-verify"] as boolean, files: args.files as string[], ignoreScripts: args["ignore-scripts"] as boolean, + execute: args.execute as string | undefined, } }; diff --git a/src/normalize-options.ts b/src/normalize-options.ts index 475aef0..68b1d44 100644 --- a/src/normalize-options.ts +++ b/src/normalize-options.ts @@ -56,6 +56,7 @@ export interface NormalizedOptions { cwd: string; interface: Interface; ignoreScripts: boolean; + execute?: string; } /** @@ -69,6 +70,7 @@ export async function normalizeOptions(raw: VersionBumpOptions): Promise