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

Function freshGraph

__tests__/sync-jsx-import-forwarding.test.ts:91–104  ·  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

89
90/** The graph of a fresh index of `files`, in a folder of its own. */
91async function freshGraph(files: Files): Promise<string[]> {
92 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-jsx-forward-fresh-'));
93 try {
94 write(dir, Object.fromEntries(Object.entries(files).filter(([, text]) => text !== null)));
95 const fresh = await CodeGraph.init(dir, { index: true });
96 try {
97 return graphOf(fresh);
98 } finally {
99 fresh.close();
100 }
101 } finally {
102 fs.rmSync(dir, { recursive: true, force: true });
103 }
104}
105
106/**
107 * Index `initial`, then write each step and sync after it — with `scoped`, a

Calls 5

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

Tested by

no test coverage detected