Skip to content

Commit

Permalink
feat: Update changelog generator (#54)
Browse files Browse the repository at this point in the history
[category:Infrastructure]
  • Loading branch information
RayRedGoose authored Oct 23, 2023
1 parent fdc28a7 commit 6aece0e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/utils/update-changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ const header = `---
---`;

const [prefix] = PACKAGE.split('-').reverse();
const regex = new RegExp(`^# (${prefix}|all|components)`, 'i');
const allowedTitles = [prefix, 'all', 'other', 'infrastructure', 'documentation'];
const regex = new RegExp(`^# (${allowedTitles.join('|')})`, 'i');

const changelogBody = CHANGESET_BODY.split('##')
const changelogBody = CHANGESET_BODY.replace('# Components', '# Other')
.split('##')
.filter(block => regex.test(block))
.map(b =>
b.replace(/# [a-zA-Z0-9_ ]*\n/g, a => {
// Canvas Kit's changelog generator defaults section headings to "Components."
// We're updating that default with use "Other" instead.
const updatedTitle = a.replace(/# |\n/g, '').replace('Components', 'Other');
const updatedTitle = a.replace(/# |\n/g, '');
return `**${updatedTitle}**\n`;
})
)
Expand Down

0 comments on commit 6aece0e

Please sign in to comment.