Skip to content

Commit

Permalink
Allow running npm version with arg --allow-same-version (#878)
Browse files Browse the repository at this point in the history
  • Loading branch information
phthhieu committed Mar 19, 2022
1 parent 832528d commit 2a7565d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/npm.md
Expand Up @@ -94,6 +94,10 @@ basically defeats the purpose of 2FA (also, the OTP expires after a short period
Use `npm.publishPath` to publish only a specific folder. For example, set `npm.publishPath` to `"dist"`. The default
value is the current (root) folder (`"."`).

## Allow same version

Use `npm.allowSameVersion` to prevent throwing error when setting the new version to the same value as the current version.

## Monorepos

Monorepos do not require extra configuration, but release-it handles only one package at a time. Also see how
Expand Down
3 changes: 2 additions & 1 deletion lib/plugin/npm/npm.js
Expand Up @@ -82,7 +82,8 @@ class npm extends Plugin {

if (!this.config.isIncrement) return false;

const task = () => this.exec(`npm version ${version} --no-git-tag-version`);
const allowSameVersion = this.options.allowSameVersion || false;
const task = () => this.exec(['npm', 'version', version, '--no-git-tag-version', allowSameVersion ? '--allow-same-version' : undefined]);
return this.spinner.show({ task, label: 'npm version' });
}

Expand Down

0 comments on commit 2a7565d

Please sign in to comment.