diff --git a/package.json b/package.json index 6270d0a..ac105ce 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "escalade": "^3.2.0", "js-yaml": "^4.1.0", "jsonc-parser": "^3.3.1", + "package-manager-detector": "^0.2.8", "prompts": "^2.4.2", "semver": "^7.6.3", "tinyexec": "^0.3.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2a40176..c095776 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,6 +23,9 @@ importers: jsonc-parser: specifier: ^3.3.1 version: 3.3.1 + package-manager-detector: + specifier: ^0.2.8 + version: 0.2.8 prompts: specifier: ^2.4.2 version: 2.4.2 @@ -2564,8 +2567,8 @@ packages: resolution: {integrity: sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==} engines: {node: '>=8'} - package-manager-detector@0.2.7: - resolution: {integrity: sha512-g4+387DXDKlZzHkP+9FLt8yKj8+/3tOkPv7DVTJGGRm00RkEWgqbFstX1mXJ4M0VDYhUqsTOiISqNOJnhAu3PQ==} + package-manager-detector@0.2.8: + resolution: {integrity: sha512-ts9KSdroZisdvKMWVAVCXiKqnqNfXz4+IbrBG8/BWx/TR5le+jfenvoBuIZ6UWM9nz47W7AbD9qYfAwfWMIwzA==} parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} @@ -3433,7 +3436,7 @@ snapshots: '@antfu/install-pkg@0.5.0': dependencies: - package-manager-detector: 0.2.7 + package-manager-detector: 0.2.8 tinyexec: 0.3.2 '@antfu/utils@0.7.10': {} @@ -6035,7 +6038,7 @@ snapshots: registry-url: 5.1.0 semver: 6.3.0 - package-manager-detector@0.2.7: {} + package-manager-detector@0.2.8: {} parent-module@1.0.1: dependencies: diff --git a/src/cli/parse-args.ts b/src/cli/parse-args.ts index d170147..fac85c6 100644 --- a/src/cli/parse-args.ts +++ b/src/cli/parse-args.ts @@ -39,6 +39,7 @@ export async function parseArgs(): Promise { noGitCheck: args.noGitCheck, confirm: !args.yes, noVerify: !args.verify, + install: args.install, files: [...(args['--'] || []), ...resultArgs], ignoreScripts: args.ignoreScripts, currentVersion: args.currentVersion, @@ -83,6 +84,7 @@ export function loadCliArgs(argv = process.argv) { .option('-t, --tag [tag]', 'Tag name', { default: true }) .option('--no-tag', 'Skip tag', { default: false }) .option('--sign', 'Sign commit and tag') + .option('--install', `Run 'npm install' after bumping version (default: ${bumpConfigDefaults.install})`, { default: false }) .option('-p, --push', `Push to remote (default: ${bumpConfigDefaults.push})`) .option('-y, --yes', `Skip confirmation (default: ${!bumpConfigDefaults.confirm})`) .option('-r, --recursive', `Bump package.json files recursively (default: ${bumpConfigDefaults.recursive})`) diff --git a/src/config.ts b/src/config.ts index d164952..5017f78 100644 --- a/src/config.ts +++ b/src/config.ts @@ -9,6 +9,7 @@ export const bumpConfigDefaults: VersionBumpOptions = { push: true, tag: true, sign: false, + install: false, recursive: false, noVerify: false, confirm: true, diff --git a/src/normalize-options.ts b/src/normalize-options.ts index 7ca111b..160a3c0 100644 --- a/src/normalize-options.ts +++ b/src/normalize-options.ts @@ -60,6 +60,7 @@ export interface NormalizedOptions { push: boolean files: string[] cwd: string + install: boolean interface: Interface ignoreScripts: boolean execute?: string | ((config: Operation) => void | PromiseLike) @@ -77,6 +78,7 @@ export async function normalizeOptions(raw: VersionBumpOptions): Promise