Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow running npm version with arg --allow-same-version #878

Merged
merged 1 commit into from Mar 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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