feat(type): initial functionality
This commit is contained in:
parent
f79e26dcd6
commit
a405021d08
@ -9,7 +9,8 @@
|
||||
"nyc": {
|
||||
"exclude": [
|
||||
".test",
|
||||
"node_modules"
|
||||
"node_modules",
|
||||
"dist/lib/error.js"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
6
src/lib/error.js
Normal file
6
src/lib/error.js
Normal file
@ -0,0 +1,6 @@
|
||||
module.exports = class SemanticReleaseError extends Error {
|
||||
constructor (message, code) {
|
||||
super(message)
|
||||
this.code = code
|
||||
}
|
||||
}
|
19
src/lib/type.js
Normal file
19
src/lib/type.js
Normal 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)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user