MCPcopy Create free account
hub / github.com/github/awesome-copilot / writeFileIfChanged

Function writeFileIfChanged

eng/update-readme.mjs:892–907  ·  view source on GitHub ↗
(filePath, content)

Source from the content-addressed store, hash-verified

890
891// Utility: write file only if content changed
892function writeFileIfChanged(filePath, content) {
893 const exists = fs.existsSync(filePath);
894 if (exists) {
895 const original = fs.readFileSync(filePath, "utf8");
896 if (original === content) {
897 console.log(
898 `${path.basename(filePath)} is already up to date. No changes needed.`
899 );
900 return;
901 }
902 }
903 fs.writeFileSync(filePath, content);
904 console.log(
905 `${path.basename(filePath)} ${exists ? "updated" : "created"} successfully!`
906 );
907}
908
909// Build per-category README content using existing generators, upgrading headings to H1
910function buildCategoryReadme(

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected