|
1 |
| -{ |
2 |
| - "git": { |
3 |
| - "commitMessage": "chore: release v${version}", |
4 |
| - "requireCommits": true |
| 1 | +module.exports = { |
| 2 | + git: { |
| 3 | + commitMessage: "chore: release v${version}", |
| 4 | + requireCommits: true, |
5 | 5 | },
|
6 |
| - "github": { |
7 |
| - "autoGenerate": true, |
8 |
| - "release": true, |
9 |
| - "releaseName": "v${version}" |
| 6 | + github: { |
| 7 | + release: true, |
| 8 | + releaseName: "v${version}", |
| 9 | + releaseNotes(context) { |
| 10 | + const groupTitles = { |
| 11 | + feat: "Features", |
| 12 | + fix: "Bug Fixes", |
| 13 | + perf: "Performance Improvements", |
| 14 | + }; |
| 15 | + const commits = context.changelog.split("\n").slice(1); |
| 16 | + const groups = Object.groupBy(commits, (commit) => { |
| 17 | + // If it matches one of the types we care to show, then add the |
| 18 | + // commit to that group. |
| 19 | + for (const type in groupTitles) { |
| 20 | + const regex = new RegExp(`^\s*[-*]?\s*${type}[(:]`); |
| 21 | + if (regex.test(commit)) { |
| 22 | + return type; |
| 23 | + } |
| 24 | + } |
| 25 | + |
| 26 | + // If it didn't match any of the important groups, then add it to other |
| 27 | + return "other"; |
| 28 | + }); |
| 29 | + |
| 30 | + // Use the data we've collected to build the release notes. |
| 31 | + const releaseNotes = []; |
| 32 | + for (const type in groupTitles) { |
| 33 | + if (groups[type]) { |
| 34 | + releaseNotes.push(`### ${groupTitles[type]}`); |
| 35 | + releaseNotes.push(...groups[type]); |
| 36 | + } |
| 37 | + } |
| 38 | + return releaseNotes.join("\n"); |
| 39 | + }, |
10 | 40 | },
|
11 |
| - "npm": { "publishArgs": ["--access public", "--provenance"] }, |
12 |
| - "plugins": { |
| 41 | + npm: { publishArgs: ["--access public", "--provenance"] }, |
| 42 | + plugins: { |
13 | 43 | "@release-it/conventional-changelog": {
|
14 |
| - "infile": "CHANGELOG.md", |
15 |
| - "preset": "angular", |
16 |
| - "types": [ |
17 |
| - { "section": "Features", "type": "feat" }, |
18 |
| - { "section": "Bug Fixes", "type": "fix" }, |
19 |
| - { "section": "Performance Improvements", "type": "perf" }, |
20 |
| - { "hidden": true, "type": "build" }, |
21 |
| - { "hidden": true, "type": "chore" }, |
22 |
| - { "hidden": true, "type": "ci" }, |
23 |
| - { "hidden": true, "type": "docs" }, |
24 |
| - { "hidden": true, "type": "refactor" }, |
25 |
| - { "hidden": true, "type": "style" }, |
26 |
| - { "hidden": true, "type": "test" } |
27 |
| - ] |
28 |
| - } |
29 |
| - } |
30 |
| -} |
| 44 | + infile: "CHANGELOG.md", |
| 45 | + preset: "angular", |
| 46 | + types: [ |
| 47 | + { section: "Features", type: "feat" }, |
| 48 | + { section: "Bug Fixes", type: "fix" }, |
| 49 | + { section: "Performance Improvements", type: "perf" }, |
| 50 | + { hidden: true, type: "build" }, |
| 51 | + { hidden: true, type: "chore" }, |
| 52 | + { hidden: true, type: "ci" }, |
| 53 | + { hidden: true, type: "docs" }, |
| 54 | + { hidden: true, type: "refactor" }, |
| 55 | + { hidden: true, type: "style" }, |
| 56 | + { hidden: true, type: "test" }, |
| 57 | + ], |
| 58 | + }, |
| 59 | + }, |
| 60 | +}; |
0 commit comments