Function
writeIfMissing
(
destination: string,
produce: () => string
)
Source from the content-addressed store, hash-verified
| 56 | } |
| 57 | |
| 58 | function writeIfMissing( |
| 59 | destination: string, |
| 60 | produce: () => string |
| 61 | ): "wrote" | "skipped" { |
| 62 | if (existsSync(destination) && !FORCE) { |
| 63 | return "skipped"; |
| 64 | } |
| 65 | ensureDir(dirname(destination)); |
| 66 | writeFileSync(destination, produce()); |
| 67 | |
| 68 | return "wrote"; |
| 69 | } |
| 70 | |
| 71 | function copyIfMissing(source: string, destination: string): "wrote" | "skipped" { |
| 72 | if (existsSync(destination) && !FORCE) { |
Tested by
no test coverage detected