Skip to content

Commit

Permalink
chore: Remove unnecessary IIFE in update-readme (#637)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic authored Oct 21, 2024
1 parent c174944 commit ee227ef
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions tools/update-readme.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,21 @@ async function fetchSponsorsMarkdown() {
// Main
//-----------------------------------------------------------------------------

(async () => {
const allSponsors = await fetchSponsorsMarkdown();
const allSponsors = await fetchSponsorsMarkdown();

README_FILE_PATHS.forEach(filePath => {
README_FILE_PATHS.forEach(filePath => {

// read readme file
const readme = readFileSync(filePath, "utf8");
// read readme file
const readme = readFileSync(filePath, "utf8");

let newReadme = readme.replace(
/<!--sponsorsstart-->[\w\W]*?<!--sponsorsend-->/u,
`<!--sponsorsstart-->\n${allSponsors}\n<!--sponsorsend-->`
);
let newReadme = readme.replace(
/<!--sponsorsstart-->[\w\W]*?<!--sponsorsend-->/u,
`<!--sponsorsstart-->\n${allSponsors}\n<!--sponsorsend-->`
);

// replace multiple consecutive blank lines with just one blank line
newReadme = newReadme.replace(/(?<=^|\n)\n{2,}/gu, "\n");
// replace multiple consecutive blank lines with just one blank line
newReadme = newReadme.replace(/(?<=^|\n)\n{2,}/gu, "\n");

// output to the files
writeFileSync(filePath, newReadme, "utf8");
});
})();
// output to the files
writeFileSync(filePath, newReadme, "utf8");
});

0 comments on commit ee227ef

Please sign in to comment.