Skip to content

Commit

Permalink
remove IIFE
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic committed Oct 8, 2024
1 parent 5a7ecb2 commit 0911a8f
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 @@ -41,22 +41,20 @@ async function fetchSponsorsMarkdown() {
// Main
//-----------------------------------------------------------------------------

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

README_FILE_PATHS.forEach(filePath => {
// read readme file
const readme = readFileSync(filePath, "utf8");
README_FILE_PATHS.forEach(filePath => {
// read readme file
const readme = readFileSync(filePath, "utf8");

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

Please sign in to comment.