Skip to content

Commit

Permalink
fix: update detection of changelog links (#587)
Browse files Browse the repository at this point in the history
Upstream changes to the Node.js `CHANGELOG.md` no longer escape `_`
characters in markdown links.

Refs: nodejs/node#40645
  • Loading branch information
Alicia Lopez committed Nov 3, 2021
1 parent 6f18eab commit 497e188
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/prepare_release.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,17 +333,15 @@ class ReleasePreparation {

const major = versionComponents.major;
const hrefLink = `doc/changelogs/CHANGELOG_V${major}.md`;
const escapedHrefLink = hrefLink.replace(/_/g, '\\_');
const newRefLink = `<a href="${hrefLink}#${newVersion}">${newVersion}</a>`;
const lastRefLink = `<a href="${hrefLink}#${lastRef}">${lastRef}</a>`;

for (let idx = 0; idx < arr.length; idx++) {
if (isLTSTransition) {
if (arr[idx].includes(escapedHrefLink)) {
arr[idx] = arr[idx].replace('**Current**', '**Long Term Support**');
} else if (arr[idx].includes(hrefLink)) {
if (arr[idx].includes(hrefLink)) {
const eolDate = getEOLDate(date);
const eol = eolDate.toISOString().split('-').slice(0, 2).join('-');
arr[idx] = arr[idx].replace('**Current**', '**Long Term Support**');
arr[idx] = arr[idx].replace('"Current"', `"LTS Until ${eol}"`);
arr[idx] = arr[idx].replace('(Current)', '(LTS)');
} else if (arr[idx].includes('**Long Term Support**')) {
Expand Down

0 comments on commit 497e188

Please sign in to comment.