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

Function plantNodeModules

__tests__/extraction.test.ts:8801–8813  ·  view source on GitHub ↗
(subproject: string, packages = 80)

Source from the content-addressed store, hash-verified

8799 });
8800
8801 function plantNodeModules(subproject: string, packages = 80): void {
8802 const base = path.join(tempDir, subproject, 'node_modules');
8803 for (let i = 0; i < packages; i++) {
8804 const pkg = path.join(base, `pkg${i}`);
8805 fs.mkdirSync(pkg, { recursive: true });
8806 fs.writeFileSync(path.join(pkg, 'index.js'), `module.exports = ${i};`);
8807 fs.writeFileSync(path.join(pkg, 'index.d.ts'), 'export const n: number;');
8808 if (i % 4 === 0) fs.writeFileSync(path.join(pkg, '.gitignore'), '*.map\n');
8809 const nested = path.join(pkg, 'node_modules', `nested${i}`);
8810 fs.mkdirSync(nested, { recursive: true });
8811 fs.writeFileSync(path.join(nested, 'lib.ts'), 'export const x = 1;');
8812 }
8813 }
8814
8815 function initGitRepo(): void {
8816 const { execFileSync } = require('child_process') as typeof import('child_process');

Callers 1

extraction.test.tsFile · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected