Repository: conventional-changelog/standard-version
Pull request #259 (2018-07-29 12:10:24)

Releasing named prerelease advises to push same tag-name
Hi,
This change adds the correct advise to push the same named tag to npm, too.
So that `npm run release -- --prerelease alpha` advises to push to the alpha tag on npm

coveralls: 
[![Coverage Status](https://coveralls.io/builds/18215962/badge)](https://coveralls.io/builds/18215962)

Coverage remained the same at 100.0% when pulling **721733436ffbfce33fe14e0f9e453acc37f6845d on spruce:master** into **e5c99f65baf5139244e649d138a6856e494e1a16 on conventional-changelog:master**.


Patch:
diff --git a/.travis.yml b/.travis.yml
index bab1008..5960012 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
 language: node_js
 node_js:
-  - "4"
-  - "5"
+  - "6"
+  - "10"
   - "stable"
 before_script:
   - git config --global user.name 'Travis-CI'
diff --git a/appveyor.yml b/appveyor.yml
index ec5ba45..3b190c9 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,6 +1,6 @@
 environment:
   matrix:
-    - nodejs_version: '6'
+    - nodejs_version: '10'
 install:
   - ps: Install-Product node $env:nodejs_version
   - git config --global user.name 'Appveyor'
diff --git a/bin/cli.js b/bin/cli.js
index 70ef2d6..d430c82 100755
--- a/bin/cli.js
+++ b/bin/cli.js
@@ -1,11 +1,11 @@
 #!/usr/bin/env node
-var standardVersion = require('../index')
-var cmdParser = require('../command')
 
 /* istanbul ignore if */
-if (process.version.match(/v(\d+)\./)[1] < 4) {
-  console.error('standard-version: Node v4 or greater is required. `standard-version` did not run.')
+if (process.version.match(/v(\d+)\./)[1] < 6) {
+  console.error('standard-version: Node v6 or greater is required. `standard-version` did not run.')
 } else {
+  const standardVersion = require('../index')
+  const cmdParser = require('../command')
   standardVersion(cmdParser.argv)
     .catch(() => {
       process.exit(1)
diff --git a/lib/lifecycles/bump.js b/lib/lifecycles/bump.js
index 0398fa4..b5fe612 100644
--- a/lib/lifecycles/bump.js
+++ b/lib/lifecycles/bump.js
@@ -50,12 +50,14 @@ Bump.getUpdatedConfigs = function () {
 Bump.pkgFiles = [
   'package.json',
   'bower.json',
-  'manifest.json'
+  'manifest.json',
+  'composer.json'
 ]
 
 Bump.lockFiles = [
   'package-lock.json',
-  'npm-shrinkwrap.json'
+  'npm-shrinkwrap.json',
+  'composer.lock'
 ]
 
 function getReleaseType (prerelease, expectedReleaseType, currentVersion) {
diff --git a/lib/lifecycles/changelog.js b/lib/lifecycles/changelog.js
index 136f830..084914d 100644
--- a/lib/lifecycles/changelog.js
+++ b/lib/lifecycles/changelog.js
@@ -28,11 +28,11 @@ function outputChangelog (args, newVersion) {
     }
     var content = ''
     var context
-    if (args.dryRun) context = {version: newVersion}
+    if (args.dryRun) context = { version: newVersion }
     var changelogStream = conventionalChangelog({
       preset: 'angular',
       tagPrefix: args.tagPrefix
-    }, context, {merges: null})
+    }, context, { merges: null })
       .on('error', function (err) {
         return reject(err)
       })
diff --git a/lib/lifecycles/tag.js b/lib/lifecycles/tag.js
index d2d4d7c..fc41acb 100644
--- a/lib/lifecycles/tag.js
+++ b/lib/lifecycles/tag.js
@@ -28,7 +28,13 @@ 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'
+      if (args.prerelease !== undefined) {
+        if (args.prerelease === '') {
+          message += ' --tag prerelease'
+        } else {
+          message += ' --tag ' + args.prerelease
+        }
+      }
 
       checkpoint(args, 'Run `%s` to publish', [message], chalk.blue(figures.info))
     })
diff --git a/lib/run-exec.js b/lib/run-exec.js
index 4ce3cb0..ffcd17d 100644
--- a/lib/run-exec.js
+++ b/lib/run-exec.js
@@ -12,7 +12,7 @@ module.exports = function (args, cmd) {
         printError(args, stderr || err.message)
         return reject(err)
       } else if (stderr) {
-        printError(args, stderr, {level: 'warn', color: 'yellow'})
+        printError(args, stderr, { level: 'warn', color: 'yellow' })
       }
       return resolve(stdout)
     })
diff --git a/package.json b/package.json
index ae7e75f..8b8a589 100644
--- a/package.json
+++ b/package.json
@@ -38,23 +38,23 @@
   },
   "homepage": "https://github.com/conventional-changelog/standard-version#readme",
   "dependencies": {
-    "chalk": "^1.1.3",
-    "conventional-changelog": "^1.1.0",
-    "conventional-recommended-bump": "^1.0.0",
+    "chalk": "^2.4.1",
+    "conventional-changelog": "^3.0.5",
+    "conventional-recommended-bump": "^4.0.4",
     "dotgitignore": "^1.0.3",
-    "figures": "^1.5.0",
+    "figures": "^2.0.0",
     "fs-access": "^1.0.0",
     "semver": "^5.1.0",
-    "yargs": "^8.0.1"
+    "yargs": "^12.0.2"
   },
   "devDependencies": {
     "chai": "^3.5.0",
     "coveralls": "^3.0.1",
     "mocha": "^5.2.0",
-    "mock-git": "^1.0.2",
+    "mock-git": "^1.0.3",
     "mockery": "^2.0.0",
-    "nyc": "^11.0.2",
-    "shelljs": "^0.7.3",
-    "standard": "^11.0.1"
+    "nyc": "^13.1.0",
+    "shelljs": "^0.7.8",
+    "standard": "^12.0.1"
   }
 }
diff --git a/renovate.json b/renovate.json
new file mode 100644
index 0000000..010732b
--- /dev/null
+++ b/renovate.json
@@ -0,0 +1,3 @@
+{
+  "enabled": false
+}


Test patch:
diff --git a/test.js b/test.js
index 31b6965..d579cd6 100644
--- a/test.js
+++ b/test.js
@@ -43,20 +43,20 @@ function execCliAsync (argString) {
 
 function writePackageJson (version, option) {
   option = option || {}
-  var pkg = Object.assign(option, {version: version})
+  var pkg = Object.assign(option, { version: version })
   fs.writeFileSync('package.json', JSON.stringify(pkg), 'utf-8')
   delete require.cache[require.resolve(path.join(process.cwd(), 'package.json'))]
 }
 
 function writeBowerJson (version, option) {
   option = option || {}
-  var bower = Object.assign(option, {version: version})
+  var bower = Object.assign(option, { version: version })
   fs.writeFileSync('bower.json', JSON.stringify(bower), 'utf-8')
 }
 
 function writeManifestJson (version, option) {
   option = option || {}
-  var manifest = Object.assign(option, {version: version})
+  var manifest = Object.assign(option, { version: version })
   fs.writeFileSync('manifest.json', JSON.stringify(manifest), 'utf-8')
 }
 
@@ -423,6 +423,14 @@ describe('cli', function () {
       commit('feat: first commit')
       execCli('--prerelease').stdout.should.include('--tag prerelease')
     })
+
+    it('advises use of --tag alpha for publishing to npm when tagging alpha', 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 alpha').stdout.should.include('--tag alpha')
+    })
   })
 
   describe('manual-release', function () {
@@ -607,7 +615,7 @@ describe('cli', function () {
   })
 
   it('does not display `npm publish` if the package is private', function () {
-    writePackageJson('1.0.0', {private: true})
+    writePackageJson('1.0.0', { private: true })
 
     var result = execCli()
     result.code.should.equal(0)
@@ -666,7 +674,7 @@ describe('standard-version', function () {
 
   describe('with mocked conventionalRecommendedBump', function () {
     beforeEach(function () {
-      mockery.enable({warnOnUnregistered: false, useCleanCache: true})
+      mockery.enable({ warnOnUnregistered: false, useCleanCache: true })
       mockery.registerMock('conventional-recommended-bump', function (_, cb) {
         cb(new Error('bump err'))
       })
@@ -682,7 +690,7 @@ describe('standard-version', function () {
       shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
       commit('feat: new feature!')
 
-      require('./index')({silent: true})
+      require('./index')({ silent: true })
         .catch((err) => {
           err.message.should.match(/bump err/)
           done()
@@ -692,9 +700,9 @@ describe('standard-version', function () {
 
   describe('with mocked conventionalChangelog', function () {
     beforeEach(function () {
-      mockery.enable({warnOnUnregistered: false, useCleanCache: true})
+      mockery.enable({ warnOnUnregistered: false, useCleanCache: true })
       mockery.registerMock('conventional-changelog', function () {
-        var readable = new stream.Readable({objectMode: true})
+        var readable = new stream.Readable({ objectMode: true })
         readable._read = function () {
         }
         setImmediate(readable.emit.bind(readable), 'error', new Error('changelog err'))
@@ -712,7 +720,7 @@ describe('standard-version', function () {
       shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
       commit('feat: new feature!')
 
-      require('./index')({silent: true})
+      require('./index')({ silent: true })
         .catch((err) => {
           err.message.should.match(/changelog err/)
           return done()
@@ -725,7 +733,7 @@ describe('standard-version', function () {
     shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
     commit('feat: new feature!')
 
-    require('./index')({silent: true})
+    require('./index')({ silent: true })
       .then(() => {
         // check last commit message
         shell.exec('git log --oneline -n1').stdout.should.match(/chore\(release\): 1\.1\.0/)
@@ -738,7 +746,7 @@ describe('standard-version', function () {
   describe('without a package file to bump', function () {
     it('should exit with error', function () {
       shell.rm('package.json')
-      return require('./index')({silent: true})
+      return require('./index')({ silent: true })
         .catch((err) => {
           err.message.should.equal('no package file found')
         })
@@ -754,7 +762,7 @@ describe('standard-version', function () {
       commit('feat: first commit')
       shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
       commit('feat: new feature!')
-      return require('./index')({silent: true})
+      return require('./index')({ silent: true })
         .then(() => {
           JSON.parse(fs.readFileSync('bower.json', 'utf-8')).version.should.equal('1.1.0')
           getPackageVersion().should.equal('1.1.0')
@@ -771,7 +779,7 @@ describe('standard-version', function () {
       commit('feat: first commit')
       shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
       commit('feat: new feature!')
-      return require('./index')({silent: true})
+      return require('./index')({ silent: true })
         .then(() => {
           JSON.parse(fs.readFileSync('manifest.json', 'utf-8')).version.should.equal('1.1.0')
           getPackageVersion().should.equal('1.1.0')
@@ -788,7 +796,7 @@ describe('standard-version', function () {
       commit('feat: first commit')
       shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
       commit('feat: new feature!')
-      require('./index')({silent: true})
+      require('./index')({ silent: true })
         .then(() => {
           JSON.parse(fs.readFileSync('npm-shrinkwrap.json', 'utf-8')).version.should.equal('1.1.0')
           getPackageVersion().should.equal('1.1.0')
@@ -807,7 +815,7 @@ describe('standard-version', function () {
       commit('feat: first commit')
       shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
       commit('feat: new feature!')
-      return require('./index')({silent: true})
+      return require('./index')({ silent: true })
         .then(() => {
           JSON.parse(fs.readFileSync('package-lock.json', 'utf-8')).version.should.equal('1.1.0')
           getPackageVersion().should.equal('1.1.0')
@@ -871,7 +879,7 @@ describe('standard-version', function () {
       commit('feat: first commit')
       shell.exec('git tag -a v1.0.0 -m "my awesome first release"')
       commit('feat: new feature!')
-      return require('./index')({silent: true})
+      return require('./index')({ silent: true })
         .then(() => {
           JSON.parse(fs.readFileSync('bower.json', 'utf-8')).version.should.equal('1.0.0')
           getPackageVersion().should.equal('1.1.0')