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

Function freshGraph

__tests__/sync-lazy-route-value.test.ts:121–134  ·  view source on GitHub ↗

The graph of a fresh index of `files`, in a folder of its own.

(files: Files)

Source from the content-addressed store, hash-verified

119
120/** The graph of a fresh index of `files`, in a folder of its own. */
121async function freshGraph(files: Files): Promise<string[]> {
122 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-lazy-route-fresh-'));
123 try {
124 write(dir, Object.fromEntries(Object.entries(files).filter(([, text]) => text !== null)));
125 const fresh = await CodeGraph.init(dir, { index: true });
126 try {
127 return graphOf(fresh);
128 } finally {
129 fresh.close();
130 }
131 } finally {
132 fs.rmSync(dir, { recursive: true, force: true });
133 }
134}
135
136/**
137 * Index `initial`, then write each step and sync after it — with `scoped`, a

Callers 1

Calls 5

writeFunction · 0.70
graphOfFunction · 0.70
closeMethod · 0.65
joinMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected