|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +/* The releaseConfig object drives configuration across 5 semantic-release plugins. For more details on the |
| 4 | +plugin options and overides used see: |
| 5 | +- @semantic-release/commit-analyzer: https://github.com/semantic-release/commit-analyzer |
| 6 | +- @semantic-release/release-notes-generator: https://github.com/semantic-release/release-notes-generator |
| 7 | +- @semantic-release/changelog: https://github.com/semantic-release/changelog |
| 8 | +- @semantic-release/npm: https://github.com/semantic-release/npm#semantic-releasenpm |
| 9 | +- @semantic-release/git: https://github.com/semantic-release/git |
| 10 | +- @semantic-release/github: https://github.com/semantic-release/github |
| 11 | +*/ |
| 12 | + |
| 13 | +function compileReleaseRules(listOfTypes, release = 'patch') { |
| 14 | + return listOfTypes.map(type => ({ |
| 15 | + type, |
| 16 | + release |
| 17 | + })); |
| 18 | +} |
| 19 | + |
| 20 | +const typesForPatch = ['docs', 'style', 'refactor', 'perf']; |
| 21 | +const typesForMinor = ['feat']; |
| 22 | +const parserOpts = { |
| 23 | + noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING'] |
| 24 | +}; |
| 25 | + |
| 26 | +const releaseConfig = { |
| 27 | + branches: ['master'], |
| 28 | + plugins: [ |
| 29 | + [ |
| 30 | + '@semantic-release/commit-analyzer', |
| 31 | + { |
| 32 | + releaseRules: [ |
| 33 | + ...compileReleaseRules(typesForPatch), |
| 34 | + ...compileReleaseRules(typesForMinor, 'minor') |
| 35 | + ], |
| 36 | + parserOpts |
| 37 | + } |
| 38 | + ], |
| 39 | + [ |
| 40 | + '@semantic-release/release-notes-generator', |
| 41 | + { |
| 42 | + parserOpts |
| 43 | + } |
| 44 | + ], |
| 45 | + '@semantic-release/changelog', |
| 46 | + [ |
| 47 | + '@semantic-release/npm', |
| 48 | + { |
| 49 | + npmPublish: false |
| 50 | + } |
| 51 | + ], |
| 52 | + [ |
| 53 | + '@semantic-release/git', |
| 54 | + { |
| 55 | + assets: ['package.json', 'package-lock.json', 'CHANGELOG.md'], |
| 56 | + message: |
| 57 | + 'chore(release): ${nextRelease.version} \n\n${nextRelease.notes}' |
| 58 | + } |
| 59 | + ], |
| 60 | + '@semantic-release/github' |
| 61 | + ] |
| 62 | +}; |
| 63 | + |
| 64 | +module.exports = releaseConfig; |
0 commit comments