Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: update detection of changelog links (take 2)
Underscores in the links to the changelogs are escaped for markdown
links but not escaped for HTML links.
  • Loading branch information
richardlau committed Oct 26, 2021
commit 0482bb80b017296c8603e85e4ff41ad83eddb261
8 changes: 5 additions & 3 deletions lib/prepare_release.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,16 +332,18 @@ class ReleasePreparation {
const arr = data.split('\n');

const major = versionComponents.major;
const hrefLink = `doc/changelogs/CHANGELOG\\_V${major}.md`;
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(hrefLink)) {
if (arr[idx].includes(escapedHrefLink)) {
arr[idx] = arr[idx].replace('**Current**', '**Long Term Support**');
} else 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('<sup>Current</sup>', '<sup>LTS</sup>');
} else if (arr[idx].includes('**Long Term Support**')) {
Expand Down