Skip to content

Commit

Permalink
fix: recommend --tag prerelease for npm publish of prereleases (con…
Browse files Browse the repository at this point in the history
…ventional-changelog#196)

The `--tag` argument to npm publish allows you to publish a prerelease without the prerelease assuming the 'latest' tag and causing users to download the prerelease by default. Instead, we recommend `--tag prerelease` by default when `--prerelease` is set in the `standard-version` call, so to install a prerelease version of the module, users will install `module@foo` or specify the exact version of the prerelease version.

Fixes conventional-changelog#183
  • Loading branch information
tmcw authored and stevemao committed Aug 8, 2017
1 parent 958daf4 commit 709dae1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/lifecycles/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function execTag (newVersion, pkgPrivate, args) {
.then(() => {
var message = 'git push --follow-tags origin master'
if (pkgPrivate !== true) message += '; npm publish'
if (args.prerelease !== undefined) message += ' --tag prerelease'

checkpoint(args, 'Run `%s` to publish', [message], chalk.blue(figures.info))
})
Expand Down
8 changes: 8 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,14 @@ describe('cli', function () {
getPackageVersion().should.equal('1.1.0-0')
})
})

it('advises use of --tag prerelease for publishing to npm', function () {
writePackageJson('1.0.0')
fs.writeFileSync('CHANGELOG.md', 'legacy header format<a name="1.0.0">\n', 'utf-8')

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

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

0 comments on commit 709dae1

Please sign in to comment.