Skip to content

Commit

Permalink
Skip "Ping npm registry" task when using --no-publish (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
oligot authored and sindresorhus committed May 26, 2018
1 parent 35cf989 commit e4b85e1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/prerequisite.js
Expand Up @@ -12,15 +12,15 @@ module.exports = (input, pkg, opts) => {
const tasks = [
{
title: 'Ping npm registry',
skip: () => pkg.private || isExternalRegistry,
skip: () => pkg.private || isExternalRegistry || !opts.publish,
task: () => pTimeout(execa.stdout('npm', ['ping'])
.catch(() => {
throw new Error('Connection to npm registry failed');
}), 15000, 'Connection to npm registry timed out')
},
{
title: 'Verify user is authenticated',
skip: () => process.env.NODE_ENV === 'test' || pkg.private || isExternalRegistry,
skip: () => process.env.NODE_ENV === 'test' || pkg.private || isExternalRegistry || !opts.publish,
task: () => execa.stdout('npm', ['whoami'])
.catch(err => {
throw new Error(/ENEEDAUTH/.test(err.stderr) ?
Expand Down Expand Up @@ -70,7 +70,7 @@ module.exports = (input, pkg, opts) => {
},
{
title: 'Check npm version',
skip: () => version.isVersionLower('6.0.0', process.version),
skip: () => version.isVersionLower('6.0.0', process.version) || !opts.publish,
task: () => execa.stdout('npm', ['version', '--json']).then(json => {
const versions = JSON.parse(json);
if (!version.satisfies(versions.npm, '>=2.15.8 <3.0.0 || >=3.10.1')) {
Expand Down

0 comments on commit e4b85e1

Please sign in to comment.