Skip to content

Commit

Permalink
make the check for Changelog preamble case-insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Jan 24, 2024
1 parent e406cdd commit 9967af9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/prepare.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ describe('prepare', function () {
);
const [, newChangelog] = mocks.writeFileSync.mock.lastCall;
expect(newChangelog).to.eq(`# A Totally ficticious Changelog
## v1.0.0
thing v1.0.0 (major)
Expand Down Expand Up @@ -63,7 +64,8 @@ thing v1.0.0 (major)
new Map([['thing', { newVersion: 'v1.0.0', impact: 'major' }]]) as any,
);
const [, newChangelog] = mocks.writeFileSync.mock.lastCall;
expect(newChangelog).to.eq(`# A Totally ficticious Changelog
expect(newChangelog).to.eq(`# A Totally ficticious CHANGELOG
## v1.0.0
thing v1.0.0 (major)
Expand All @@ -77,5 +79,4 @@ thing v1.0.0 (major)
- spent a lot of time trying to figure out releases (if only there was a tool to help with that)
`);
});

});
4 changes: 2 additions & 2 deletions src/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import fsExtra from 'fs-extra';

const { readJSONSync, writeJSONSync } = fsExtra;

const changelogPreamblePattern = /#.*Changelog.*$/;
const changelogPreamblePattern = /#.*Changelog.*$/i;

export function updateChangelog(
newChangelogContent: string,
Expand Down Expand Up @@ -38,7 +38,7 @@ export function updateChangelog(
writeFileSync(
targetChangelogFile,
oldChangelogContent[0] +
'\n' +
'\n\n' +
newOutput +
oldChangelogContent.slice(1).join('\n'),
);
Expand Down

0 comments on commit 9967af9

Please sign in to comment.