Skip to content

Commit

Permalink
Prompt for npm OTP in --only-version (fixes #948)
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Dec 2, 2022
1 parent 331b0de commit ff626d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/plugin/Plugin.js
Expand Up @@ -65,7 +65,8 @@ class Plugin {
step(options) {
const context = Object.assign({}, this.config.getContext(), { [this.namespace]: this.getContext() });
const opts = Object.assign({}, options, { context });
return this.config.isCI ? this.spinner.show(opts) : this.showPrompt(opts);
const isException = this.config.isPromptOnlyVersion && ['incrementList', 'publish', 'otp'].includes(opts.prompt);
return this.config.isCI && !isException ? this.spinner.show(opts) : this.showPrompt(opts);
}
}

Expand Down
3 changes: 2 additions & 1 deletion lib/plugin/npm/npm.js
Expand Up @@ -92,7 +92,8 @@ class npm extends Plugin {
release() {
if (this.options.publish === false) return false;
const publish = () => this.publish({ otpCallback });
const otpCallback = this.config.isCI ? null : task => this.step({ prompt: 'otp', task });
const otpCallback =
this.config.isCI && !this.config.isPromptOnlyVersion ? null : task => this.step({ prompt: 'otp', task });
return this.step({ task: publish, label: 'npm publish', prompt: 'publish' });
}

Expand Down

0 comments on commit ff626d1

Please sign in to comment.