Skip to content

Commit

Permalink
add externallinks
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahgm committed Sep 23, 2024
1 parent 41f7838 commit 3baaea6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/scripts/build-changelog.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ const addFrontmatter = (sourceText, versions) => {
return sourceText;
};

const appendExternalLinks = (sourceText, path) => {
const regex = /^## .*/m;
let externalLinks = '';
externalLinks += `_[Read the full changelog](https://github.com/marigold-ui/marigold/blob/main/${path}/CHANGELOG.md)_`;
return sourceText.replace(regex, match => `${externalLinks}\n${match}`);
};

// generate folder structure for changelogs
changelogPath.forEach(async file => {
const data = fs.readFileSync(file, 'utf8');
Expand All @@ -66,6 +73,7 @@ changelogPath.forEach(async file => {
const versions = await getBadge(file);

changelogModified = addFrontmatter(changelogModified, versions);
changelogModified = appendExternalLinks(changelogModified, packages);
fs.mkdirSync(changelogDir, {
recursive: true,
});
Expand Down

0 comments on commit 3baaea6

Please sign in to comment.