|
1 | 1 | /* eslint no-template-curly-in-string: 0 */ |
2 | 2 |
|
3 | 3 | // https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-angular/writer-opts.js |
4 | | -customTransform = (commit, context) => { |
| 4 | +const transformCommitType = type => { |
| 5 | + const commitTypeMapping = { |
| 6 | + feat: 'Features', |
| 7 | + fix: 'Bug Fixes', |
| 8 | + perf: 'Performance Improvements', |
| 9 | + revert: 'Reverts', |
| 10 | + docs: 'Documentation', |
| 11 | + style: 'Styles', |
| 12 | + refactor: 'Code Refactoring', |
| 13 | + test: 'Tests', |
| 14 | + build: 'Build System', |
| 15 | + ci: 'Continuous Integration', |
| 16 | + chore: 'Chores', |
| 17 | + default: 'Miscellaneous' |
| 18 | + } |
| 19 | + return commitTypeMapping[type] || commitTypeMapping.default |
| 20 | +} |
| 21 | + |
| 22 | +const customTransform = (commit, context) => { |
5 | 23 | const issues = [] |
6 | 24 |
|
7 | 25 | commit.notes.forEach(note => { |
8 | 26 | note.title = 'BREAKING CHANGES' |
9 | 27 | }) |
10 | 28 |
|
11 | | - if (commit.type === 'feat') { |
12 | | - commit.type = 'Features' |
13 | | - } else if (commit.type === 'fix') { |
14 | | - commit.type = 'Bug Fixes' |
15 | | - } else if (commit.type === 'perf') { |
16 | | - commit.type = 'Performance Improvements' |
17 | | - } else if (commit.type === 'revert' || commit.revert) { |
18 | | - commit.type = 'Reverts' |
19 | | - } else if (commit.type === 'docs') { |
20 | | - commit.type = 'Documentation' |
21 | | - } else if (commit.type === 'style') { |
22 | | - commit.type = 'Styles' |
23 | | - } else if (commit.type === 'refactor') { |
24 | | - commit.type = 'Code Refactoring' |
25 | | - } else if (commit.type === 'test') { |
26 | | - commit.type = 'Tests' |
27 | | - } else if (commit.type === 'build') { |
28 | | - commit.type = 'Build System' |
29 | | - } else if (commit.type === 'ci') { |
30 | | - commit.type = 'Continuous Integration' |
31 | | - } else { |
32 | | - return |
33 | | - } |
| 29 | + commit.type = transformCommitType(commit.type) |
34 | 30 |
|
35 | 31 | if (commit.scope === '*') { |
36 | 32 | commit.scope = '' |
@@ -77,8 +73,8 @@ customTransform = (commit, context) => { |
77 | 73 | module.exports = { |
78 | 74 | branches: [ |
79 | 75 | // https://github.com/semantic-release/semantic-release/blob/master/docs/usage/workflow-configuration.md#workflow-configuration |
80 | | - {name: 'trunk', channel: 'latest'}, |
81 | | - {name: 'beta', channel: 'beta', prerelease: 'beta'} |
| 76 | + { name: 'trunk', channel: 'latest' }, |
| 77 | + { name: 'beta', channel: 'beta', prerelease: 'beta' } |
82 | 78 | ], |
83 | 79 | plugins: [ |
84 | 80 | ['@semantic-release/commit-analyzer', { |
|
0 commit comments