(files: Record<string, string>)
| 36 | interface Project { dir: string; cg: CodeGraph } |
| 37 | |
| 38 | async function buildProject(files: Record<string, string>): Promise<Project> { |
| 39 | const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'codegraph-named-valve-')); |
| 40 | for (const [rel, body] of Object.entries(files)) { |
| 41 | fs.mkdirSync(path.dirname(path.join(dir, rel)), { recursive: true }); |
| 42 | fs.writeFileSync(path.join(dir, rel), body); |
| 43 | } |
| 44 | const cg = CodeGraph.initSync(dir); |
| 45 | await cg.indexAll(); |
| 46 | return { dir, cg }; |
| 47 | } |
| 48 | |
| 49 | function destroyProject(p?: Project): void { |
| 50 | if (!p) return; |
no test coverage detected