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

Function linkTree

__tests__/daemon-older-version.test.ts:322–332  ·  view source on GitHub ↗
(from: string, to: string)

Source from the content-addressed store, hash-verified

320function makeInstall(version: string): string {
321 const dir = fs.mkdtempSync(path.join(os.tmpdir(), `cg-install-${version}-`));
322 const linkTree = (from: string, to: string): void => {
323 fs.mkdirSync(to, { recursive: true });
324 for (const entry of fs.readdirSync(from, { withFileTypes: true })) {
325 const source = path.join(from, entry.name);
326 const target = path.join(to, entry.name);
327 if (entry.isDirectory()) linkTree(source, target);
328 else {
329 try { fs.linkSync(source, target); } catch { fs.copyFileSync(source, target); }
330 }
331 }
332 };
333 linkTree(DIST, path.join(dir, 'dist'));
334 fs.symlinkSync(NODE_MODULES, path.join(dir, 'node_modules'), 'junction');
335 fs.writeFileSync(path.join(dir, 'package.json'), JSON.stringify({ name: '@colbymchenry/codegraph', version }) + '\n');

Callers 1

makeInstallFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected