MCPcopy Create free account
hub / github.com/babel/babel / writeGeneratedFile

Function writeGeneratedFile

Gulpfile.ts:105–113  ·  view source on GitHub ↗

* Write a generated source file, but only if its content changed: unchanged * files keep their mtime so they are not compiled again.

(filename: string, content: string)

Source from the content-addressed store, hash-verified

103 * files keep their mtime so they are not compiled again.
104 */
105function writeGeneratedFile(filename: string, content: string) {
106 try {
107 if (fs.readFileSync(filename, "utf8") === content) return;
108 } catch (err: any) {
109 if (err.code !== "ENOENT") throw err;
110 }
111 fs.mkdirSync(path.dirname(filename), { recursive: true });
112 fs.writeFileSync(filename, content, { mode: 0o644 });
113}
114
115async function generateHelpers(
116 generator: string,

Callers 2

generateHelpersFunction · 0.85
generateStandaloneFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected