mt-changelog
Version:
creates changelogs for git projects
32 lines (28 loc) • 827 B
JavaScript
;
Object.defineProperty(exports, '__esModule', {
value: true
});
exports.parseLog = parseLog;
exports['default'] = gitLog;
var _childProcessPromise = require('child-process-promise');
function parseLog(logEntries, commitFilterRgx) {
return logEntries.filter(function (commit) {
return commitFilterRgx.test(commit);
}).map(function (raw) {
var match = /^([a-f|0-9]+) (.*)$/.exec(raw);
return {
raw: raw,
sha: match[1],
message: match[2],
toString: function toString() {
return raw;
}
};
});
}
function gitLog(fromTag, commitFilterRgx) {
return (0, _childProcessPromise.exec)('git log --no-merges --oneline ' + fromTag + '..HEAD').then(function (_ref) {
var stdout = _ref.stdout;
return parseLog(stdout.split('\n'), commitFilterRgx);
});
}