| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 92dce6e commit f210a15
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,14 +19,24 @@ const stdinLineByLine = createInterface(process.stdin)[Symbol.asyncIterator](); | |||
| 19 | 19 | ||
| 20 | 20 | const changelog = await readFile(CHANGELOG_PATH, 'utf-8'); | |
| 21 | 21 | const commitListingStart = changelog.indexOf('\n### Commits\n'); | |
| 22 | - const commitListingEnd = changelog.indexOf('\n\n<a', commitListingStart); | ||
| 23 | - const commitList = changelog.slice(commitListingStart, commitListingEnd === -1 ? undefined : commitListingEnd + 1) | ||
| 24 | - // Checking for semverness is too expansive, it is left as a exercice for human reviewers. | ||
| 22 | + let commitList; | ||
| 23 | + if (commitListingStart === -1) { | ||
| 24 | + // We're preparing a semver-major release. | ||
| 25 | + commitList = changelog.replace(/(^.+\n### Semver-Major|\n### Semver-(Minor|Patch)) Commits\n/gs, '') | ||
| 26 | + .replaceAll('**(SEMVER-MAJOR)** ', ''); | ||
| 27 | + } else { | ||
| 28 | + const commitListingEnd = changelog.indexOf('\n\n<a', commitListingStart); | ||
| 29 | + assert.notStrictEqual(commitListingEnd, -1); | ||
| 30 | + commitList = changelog.slice(commitListingStart, commitListingEnd + 1); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + // Normalize for consistent comparison | ||
| 34 | + commitList = commitList | ||
| 25 | 35 | .replaceAll('**(SEMVER-MINOR)** ', '') | |
| 26 | - // Correct Markdown escaping is validated by the linter, getting rid of it here helps. | ||
| 27 | 36 | .replaceAll('\\', ''); | |
| 28 | 37 | ||
| 29 | - let expectedNumberOfCommitsLeft = commitList.match(/\n\* \[/g).length; | ||
| 38 | + let expectedNumberOfCommitsLeft = commitList.match(/\n\* \[/g)?.length ?? 0; | ||
| 39 | + | ||
| 30 | 40 | for await (const line of stdinLineByLine) { | |
| 31 | 41 | const { smallSha, title, prURL } = JSON.parse(line); | |
| 32 | 42 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments