diff --git a/src/cli/parse-args.ts b/src/cli/parse-args.ts index 05fdd6d..01304de 100644 --- a/src/cli/parse-args.ts +++ b/src/cli/parse-args.ts @@ -37,8 +37,8 @@ export async function parseArgs(): Promise { push: args.push, all: args.all, noGitCheck: args.noGitCheck, - confirm: !args.yes, - noVerify: !args.verify, + confirm: args.yes === undefined ? undefined : !args.yes, + noVerify: args.verify === undefined ? undefined : !args.verify, install: args.install, files: [...(args['--'] || []), ...resultArgs], ignoreScripts: args.ignoreScripts, @@ -102,18 +102,28 @@ export function loadCliArgs(argv = process.argv) { const rawArgs = cli.rawArgs const args = result.options + // TODO: To simplify the checks here, should we move the default value declaration to config.ts/bumpConfigDefaults? const COMMIT_REG = /(?:-c|--commit|--no-commit)(?:=.*|$)/ const TAG_REG = /(?:-t|--tag|--no-tag)(?:=.*|$)/ + const YES_REG = /(?:-y|--yes)(?:=.*|$)/ + const NO_VERIFY_REG = /--no-verify(?:=.*|$)/ + const INSTALL_ARG = /--install(?:=.*|$)/ const hasCommitFlag = rawArgs.some(arg => COMMIT_REG.test(arg)) const hasTagFlag = rawArgs.some(arg => TAG_REG.test(arg)) + const hasYesFlag = rawArgs.some(arg => YES_REG.test(arg)) + const hasNoVerifyFlag = rawArgs.some(arg => NO_VERIFY_REG.test(arg)) + const hasInstallFlag = rawArgs.some(arg => INSTALL_ARG.test(arg)) - const { tag, commit, ...rest } = args + const { tag, commit, yes, ...rest } = args return { args: { ...rest, commit: hasCommitFlag ? commit : undefined, tag: hasTagFlag ? tag : undefined, + yes: hasYesFlag ? yes : undefined, + verify: hasNoVerifyFlag ? !args.verify : undefined, + install: hasInstallFlag ? !args.install : undefined } as { [k: string]: any }, resultArgs: result.args, } diff --git a/src/config.ts b/src/config.ts index 5017f78..755e6f7 100644 --- a/src/config.ts +++ b/src/config.ts @@ -33,6 +33,7 @@ export async function loadBumpConfig( }, cwd: configFile ? dirname(configFile) : cwd, }) + return config! }