Skip to content

Commit

Permalink
Skip all prerequisite checks when using --no-publish
Browse files Browse the repository at this point in the history
Follow-up to #226
  • Loading branch information
sindresorhus committed May 26, 2018
1 parent e4b85e1 commit 24fa0cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions index.js
Expand Up @@ -48,6 +48,7 @@ module.exports = (input, opts) => {
const tasks = new Listr([
{
title: 'Prerequisite check',
enabled: () => runPublish,
task: () => prerequisiteTasks(input, pkg, opts)
},
{
Expand Down
7 changes: 3 additions & 4 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 || !opts.publish,
skip: () => pkg.private || isExternalRegistry,
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 || !opts.publish,
skip: () => process.env.NODE_ENV === 'test' || pkg.private || isExternalRegistry,
task: () => execa.stdout('npm', ['whoami'])
.catch(err => {
throw new Error(/ENEEDAUTH/.test(err.stderr) ?
Expand Down Expand Up @@ -61,7 +61,6 @@ module.exports = (input, pkg, opts) => {
},
{
title: 'Check for pre-release version',
enabled: () => opts.publish,
task: () => {
if (!pkg.private && version.isPrereleaseVersion(newVersion) && !opts.tag) {
throw new Error('You must specify a dist-tag using --tag when publishing a pre-release version. This prevents accidentally tagging unstable versions as "latest". https://docs.npmjs.com/cli/dist-tag');
Expand All @@ -70,7 +69,7 @@ module.exports = (input, pkg, opts) => {
},
{
title: 'Check npm version',
skip: () => version.isVersionLower('6.0.0', process.version) || !opts.publish,
skip: () => version.isVersionLower('6.0.0', process.version),
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 24fa0cd

Please sign in to comment.