conventional-recommended-bump.js 613 B

1234567891011121314151617181920212223242526272829303132
  1. 'use strict'
  2. const parserOpts = require('./parser-opts')
  3. module.exports = {
  4. parserOpts,
  5. whatBump: commits => {
  6. let level = 2
  7. let breakings = 0
  8. let features = 0
  9. commits.forEach(commit => {
  10. if (!commit.tag) return
  11. if (commit.tag.toLowerCase() === 'breaking') {
  12. breakings += 1
  13. level = 0
  14. } else if (commit.tag.toLowerCase() === 'new') {
  15. features += 1
  16. if (level === 2) {
  17. level = 1
  18. }
  19. }
  20. })
  21. return {
  22. level: level,
  23. reason: `There are ${breakings} breaking changes and ${features} features`
  24. }
  25. }
  26. }