MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / write

Function write

__tests__/sync-nested-barrel-route.test.ts:73–83  ·  view source on GitHub ↗
(dir: string, files: Files)

Source from the content-addressed store, hash-verified

71});
72
73const write = (dir: string, files: Files): void => {
74 for (const [rel, content] of Object.entries(files)) {
75 const file = path.join(dir, rel);
76 if (content === null) {
77 fs.rmSync(file, { force: true });
78 continue;
79 }
80 fs.mkdirSync(path.dirname(file), { recursive: true });
81 fs.writeFileSync(file, content);
82 }
83};
84/** A project of `files`, indexed from scratch in a folder of its own. */
85const indexed = async (files: Files): Promise<{ dir: string; graph: CodeGraph }> => {
86 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-sync-nested-barrel-'));

Callers 2

indexedFunction · 0.70

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected