From ff626d1d9e4a434f77f52e8b3673e252a8bbe8e5 Mon Sep 17 00:00:00 2001 From: Lars Kappert Date: Fri, 2 Dec 2022 09:06:58 -0300 Subject: [PATCH] Prompt for npm OTP in --only-version (fixes #948) --- lib/plugin/Plugin.js | 3 ++- lib/plugin/npm/npm.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/plugin/Plugin.js b/lib/plugin/Plugin.js index 77390997..4fb667ae 100644 --- a/lib/plugin/Plugin.js +++ b/lib/plugin/Plugin.js @@ -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); } } diff --git a/lib/plugin/npm/npm.js b/lib/plugin/npm/npm.js index 8765b473..c7c5d887 100644 --- a/lib/plugin/npm/npm.js +++ b/lib/plugin/npm/npm.js @@ -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' }); }