feat(plugins): normalize plugins and have unified function signature

This commit is contained in:
Stephan Bönnemann
2015-06-18 16:48:28 -07:00
parent da23c15ea5
commit 057e8e9759
7 changed files with 50 additions and 26 deletions
+11 -9
View File
@@ -1,16 +1,18 @@
const SemanticReleaseError = require('./error')
module.exports = function (plugins, commits, lastRelease, cb) {
const type = plugins.analyze(commits)
plugins.analyze(commits, (err, type) => {
if (err) return cb(err)
if (!type) {
return cb(new SemanticReleaseError(
'There are no relevant changes, so no new version is released',
'ENOCHANGE'
))
}
if (!type) {
return cb(new SemanticReleaseError(
'There are no relevant changes, so no new version is released',
'ENOCHANGE'
))
}
if (!lastRelease.version) return cb(null, 'initial')
if (!lastRelease.version) return cb(null, 'initial')
cb(null, type)
cb(null, type)
})
}