MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / writeIfMissing

Function writeIfMissing

scripts/spec-init.ts:58–69  ·  view source on GitHub ↗
(
  destination: string,
  produce: () => string
)

Source from the content-addressed store, hash-verified

56}
57
58function 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
71function copyIfMissing(source: string, destination: string): "wrote" | "skipped" {
72 if (existsSync(destination) && !FORCE) {

Callers 1

runFunction · 0.85

Calls 1

ensureDirFunction · 0.85

Tested by

no test coverage detected