Skip to content

Commit

Permalink
fix: no --tag prerelease for private module (#296)
Browse files Browse the repository at this point in the history
fixes: #294
  • Loading branch information
Yves Richard authored and bcoe committed Feb 14, 2019
1 parent 7e443da commit 27e2ab4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/lifecycles/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ function execTag (newVersion, pkgPrivate, args) {
return runExec(args, 'git tag ' + tagOption + args.tagPrefix + newVersion + ' -m "' + formatCommitMessage(args.message, newVersion) + '"')
.then(() => {
var message = 'git push --follow-tags origin master'
if (pkgPrivate !== true) message += ' && npm publish'
if (args.prerelease !== undefined) {
if (args.prerelease === '') {
message += ' --tag prerelease'
} else {
message += ' --tag ' + args.prerelease
if (pkgPrivate !== true) {
message += ' && npm publish'
if (args.prerelease !== undefined) {
if (args.prerelease === '') {
message += ' --tag prerelease'
} else {
message += ' --tag ' + args.prerelease
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,14 @@ describe('cli', function () {
commit('feat: first commit')
execCli('--prerelease alpha').stdout.should.include('--tag alpha')
})

it('does not advise use of --tag prerelease for private modules', function () {
writePackageJson('1.0.0', { private: true })
fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')

commit('feat: first commit')
execCli('--prerelease').stdout.should.not.include('--tag prerelease')
})
})

describe('manual-release', function () {
Expand Down

0 comments on commit 27e2ab4

Please sign in to comment.