Skip to content

Commit b684c78

Browse files
edahlsengbcoe
authored andcommittedFeb 27, 2019
fix: make pattern for finding CHANGELOG sections work for non anchors (#292)
1 parent 04513e8 commit b684c78

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎lib/lifecycles/changelog.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ function outputChangelog (args, newVersion) {
2323
var header = '# Change Log\n\nAll notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n'
2424
var oldContent = args.dryRun ? '' : fs.readFileSync(args.infile, 'utf-8')
2525
// find the position of the last release and remove header:
26-
if (oldContent.indexOf('<a name=') !== -1) {
27-
oldContent = oldContent.substring(oldContent.indexOf('<a name='))
26+
const changelogSectionRegExp = /<a name=|##? \[?[0-9]+\.[0-9]+\.[0-9]+\]?/
27+
if (oldContent.search(changelogSectionRegExp) !== -1) {
28+
oldContent = oldContent.substring(oldContent.search(changelogSectionRegExp))
2829
}
2930
var content = ''
3031
var context

0 commit comments

Comments
 (0)
Please sign in to comment.