feat(last-release): add custom dist-tag

This commit is contained in:
Stephan Bönnemann
2015-07-16 11:51:33 +02:00
parent 6cf1711151
commit dbea5cc1b1
2 changed files with 18 additions and 7 deletions
+7 -2
View File
@@ -1,3 +1,5 @@
const SemanticReleaseError = require('@semantic-release/error')
const npmlog = require('npmlog')
const RegClient = require('npm-registry-client')
@@ -11,11 +13,14 @@ module.exports = function (pkg, npmConfig, cb) {
if (err && err.statusCode === 404) return cb(null, {})
if (err) return cb(err)
const version = data['dist-tags'].latest
const version = data['dist-tags'][npmConfig.tag]
if (!version) return cb(new SemanticReleaseError(`There is no release with the dist-tag "${npmConfig.tag}" yet. Tag a version first.`, 'ENODISTTAG'))
cb(null, {
version,
gitHead: data.versions[version].gitHead
gitHead: data.versions[version].gitHead,
tag: npmConfig.tag
})
})
}