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

Function plantNodeModules

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

Source from the content-addressed store, hash-verified

8796 });
8797
8798 function plantNodeModules(subproject: string, packages = 80): void {
8799 const base = path.join(tempDir, subproject, 'node_modules');
8800 for (let i = 0; i < packages; i++) {
8801 const pkg = path.join(base, `pkg${i}`);
8802 fs.mkdirSync(pkg, { recursive: true });
8803 fs.writeFileSync(path.join(pkg, 'index.js'), `module.exports = ${i};`);
8804 fs.writeFileSync(path.join(pkg, 'index.d.ts'), 'export const n: number;');
8805 if (i % 4 === 0) fs.writeFileSync(path.join(pkg, '.gitignore'), '*.map\n');
8806 const nested = path.join(pkg, 'node_modules', `nested${i}`);
8807 fs.mkdirSync(nested, { recursive: true });
8808 fs.writeFileSync(path.join(nested, 'lib.ts'), 'export const x = 1;');
8809 }
8810 }
8811
8812 function initGitRepo(): void {
8813 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