Skip to content

Commit

Permalink
Skip publish prompt when package.json has private: true (fixes #936)
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Mar 9, 2023
1 parent 56787b5 commit d816d40
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/plugin/npm/npm.js
Expand Up @@ -91,6 +91,7 @@ class npm extends Plugin {

release() {
if (this.options.publish === false) return false;
if (this.getContext('private')) return false;
const publish = () => this.publish({ otpCallback });
const otpCallback =
this.config.isCI && !this.config.isPromptOnlyVersion ? null : task => this.step({ prompt: 'otp', task });
Expand Down
2 changes: 1 addition & 1 deletion test/tasks.js
Expand Up @@ -384,7 +384,7 @@ test.serial('should handle private package correctly, bump lockfile', async t =>
const npmArgs = getArgs(container.shell.exec.args, 'npm');
t.deepEqual(npmArgs, ['npm version 1.0.1 --no-git-tag-version']);
t.true(log.obtrusive.firstCall.args[0].endsWith(`release ${pkgName} (1.0.0...1.0.1)`));
t.is(log.warn.lastCall.args[0], 'Skip publish: package is private.');
t.is(log.warn.length, 0);
t.regex(log.log.firstCall.args[0], /Done \(in [0-9]+s\.\)/);

exec.restore();
Expand Down

0 comments on commit d816d40

Please sign in to comment.