diff --git a/src/prepare.test.ts b/src/prepare.test.ts index 2cb6f4f..6b45e11 100644 --- a/src/prepare.test.ts +++ b/src/prepare.test.ts @@ -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) @@ -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) @@ -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) `); }); - }); diff --git a/src/prepare.ts b/src/prepare.ts index 2600ba7..277f9b7 100644 --- a/src/prepare.ts +++ b/src/prepare.ts @@ -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, @@ -38,7 +38,7 @@ export function updateChangelog( writeFileSync( targetChangelogFile, oldChangelogContent[0] + - '\n' + + '\n\n' + newOutput + oldChangelogContent.slice(1).join('\n'), );