UNPKG

574 BJavaScriptView Raw
1'use strict'
2
3const parserOpts = require('./parser-opts')
4
5module.exports = {
6 parserOpts,
7
8 whatBump: (commits) => {
9 let level = 2
10 let breakings = 0
11 let features = 0
12
13 commits.forEach(commit => {
14 if (commit.notes.length > 0) {
15 breakings += commit.notes.length
16 level = 0
17 } else if (commit.type === 'feat') {
18 features += 1
19 if (level === 2) {
20 level = 1
21 }
22 }
23 })
24
25 return {
26 level: level,
27 reason: `There are ${breakings} BREAKING CHANGES and ${features} features`
28 }
29 }
30}