MCPcopy
hub / github.com/colbymchenry/codegraph / makeConsumer

Function makeConsumer

__tests__/npm-sdk.test.ts:33–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31// fake platform package, when present, is written as a resolvable sibling so the
32// SDK's `require.resolve('@colbymchenry/codegraph-<target>/...')` walks to it.
33function makeConsumer(): { root: string; mainPkg: string } {
34 const root = mkTmp('consumer');
35 const mainPkg = path.join(root, 'node_modules', '@colbymchenry', 'codegraph');
36 fs.mkdirSync(mainPkg, { recursive: true });
37 fs.copyFileSync(SDK_SRC, path.join(mainPkg, 'npm-sdk.js'));
38 fs.writeFileSync(
39 path.join(mainPkg, 'package.json'),
40 JSON.stringify({ name: '@colbymchenry/codegraph', version: VERSION, main: 'npm-sdk.js' }) + '\n'
41 );
42 return { root, mainPkg };
43}
44
45// Write a fake compiled library that exports a sentinel, at the given lib/dist
46// root (used both for the platform package and the self-heal cache bundle).

Callers 1

npm-sdk.test.tsFile · 0.85

Calls 2

joinMethod · 0.80
mkTmpFunction · 0.70

Tested by

no test coverage detected