Skip to content

Commit

Permalink
fix: stop suggesting npm publish if package.json was not updated
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniGod committed Apr 17, 2019
1 parent 38557a1 commit 427b891
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion 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')
Expand Down Expand Up @@ -27,7 +28,7 @@ function execTag (newVersion, pkgPrivate, args) {
return runExec(args, 'git tag ' + tagOption + args.tagPrefix + newVersion + ' -m "' + formatCommitMessage(args.message, newVersion) + '"')
.then(() => {
let message = 'git push --follow-tags origin master'
if (pkgPrivate !== true) {
if (pkgPrivate !== true && bump.getUpdatedConfigs()['package.json']) {
message += ' && npm publish'
if (args.prerelease !== undefined) {
if (args.prerelease === '') {
Expand Down
7 changes: 7 additions & 0 deletions test.js
Expand Up @@ -988,5 +988,12 @@ 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')
var result = execCli()
result.code.should.equal(0)
result.stdout.should.not.match(/npm publish/)
})
})
})

0 comments on commit 427b891

Please sign in to comment.