diff --git a/lib/lifecycles/tag.js b/lib/lifecycles/tag.js index 29b60cf82..44c3bf1a5 100644 --- a/lib/lifecycles/tag.js +++ b/lib/lifecycles/tag.js @@ -1,3 +1,4 @@ +const bump = require('../lifecycles/bump') const chalk = require('chalk') const checkpoint = require('../checkpoint') const figures = require('figures') @@ -28,7 +29,7 @@ function execTag (newVersion, pkgPrivate, args) { .then(() => runExec('', 'git rev-parse --abbrev-ref HEAD')) .then((currentBranch) => { let message = 'git push --follow-tags origin ' + currentBranch.trim() - if (pkgPrivate !== true) { + if (pkgPrivate !== true && bump.getUpdatedConfigs()['package.json']) { message += ' && npm publish' if (args.prerelease !== undefined) { if (args.prerelease === '') { diff --git a/test.js b/test.js index 3c0923284..2aac18a1f 100644 --- a/test.js +++ b/test.js @@ -1030,6 +1030,13 @@ describe('standard-version', function () { output.stdout.should.include('v5.1.0') }) }) + + it('does not display `npm publish` if there is no package.json', function () { + shell.rm('package.json') + const result = execCli() + result.code.should.equal(0) + result.stdout.should.not.match(/npm publish/) + }) }) describe('configuration', () => {