feat(pre): add initial version of command

This commit is contained in:
Stephan Bönnemann
2015-02-02 04:13:21 +01:00
parent f31a5dfd04
commit 0ee9cc31e9
5 changed files with 90 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
'use strict'
module.exports = function (commits) {
var type = null
commits.every(function (commit) {
if (commit.breaks.length) {
type = 'major'
return false
}
if (commit.type === 'feat') type = 'minor'
if (!type && commit.type === 'fix') type = 'patch'
return true
})
return type
}
+14
View File
@@ -0,0 +1,14 @@
'use strict'
var git = require('conventional-changelog/lib/git')
module.exports = function (cb) {
git.latestTag(function (err, from) {
if (err) return cb(err)
git.getCommits({from: from}, function (err, commits) {
if (err) return cb(err)
cb(null, commits)
})
})
}
+12
View File
@@ -0,0 +1,12 @@
'use strict'
var commits = require('./commits')
var analyze = require('./analyze')
module.exports = function (cb) {
commits(function (err, commits) {
if (err) return cb(err)
cb(null, analyze(commits))
})
}