feat(type): initial functionality

This commit is contained in:
Stephan Bönnemann
2015-06-14 19:40:05 -07:00
parent f79e26dcd6
commit a405021d08
3 changed files with 27 additions and 1 deletions
+6
View File
@@ -0,0 +1,6 @@
module.exports = class SemanticReleaseError extends Error {
constructor (message, code) {
super(message)
this.code = code
}
}
+19
View File
@@ -0,0 +1,19 @@
const SemanticReleaseError = require('./error')
module.exports = function (plugins, results, cb) {
const commits = results.commits
const lastRelease = results.lastRelease
const type = plugins.analyze(commits)
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')
cb(null, type)
}