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

Function srcBuildFolderOf

src/extraction/index.ts:372–386  ·  view source on GitHub ↗

* The `build` folder below a `src/` folder that file `rel` sits in, with a * trailing slash (`src/build/` for `src/build/legacy/page.tsx`), or null. A JVM * package named `build` (#1642) does not count.

(rel: string)

Source from the content-addressed store, hash-verified

370 * package named `build` (#1642) does not count.
371 */
372function srcBuildFolderOf(rel: string): string | null {
373 if (!/(?:^|\/)build\//i.test(rel)) return null;
374 const parts = rel.split('/');
375 let inSrc = false;
376 for (let i = 0; i < parts.length - 1; i++) {
377 const part = parts[i]!.toLowerCase();
378 if (part === 'src') {
379 inSrc = true;
380 } else if (part === 'build' && inSrc) {
381 const folder = parts.slice(0, i + 1).join('/') + '/';
382 return jvmBuildPackages.ignores(folder) ? null : folder;
383 }
384 }
385 return null;
386}
387
388/**
389 * When `rel` is a file in a `build` folder below `src/` that a build step could

Callers 1

Calls 2

ignoresMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected