* 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)
| 103 | * files keep their mtime so they are not compiled again. |
| 104 | */ |
| 105 | function 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 | |
| 115 | async function generateHelpers( |
| 116 | generator: string, |
no outgoing calls
no test coverage detected