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

Function parsePnpmPackages

src/resolution/workspace-packages.ts:272–292  ·  view source on GitHub ↗

* Minimal pnpm-workspace.yaml `packages:` extractor. Handles the only shape * pnpm actually uses: * packages: * - 'packages/*' * - "apps/*" * - tools/build

(yaml: string)

Source from the content-addressed store, hash-verified

270 * - tools/build
271 */
272function parsePnpmPackages(yaml: string): string[] {
273 const out: string[] = [];
274 const lines = yaml.split(/\r?\n/);
275 let inPackages = false;
276 for (const line of lines) {
277 if (/^\s*packages\s*:/.test(line)) {
278 inPackages = true;
279 continue;
280 }
281 if (inPackages) {
282 const item = line.match(/^\s*-\s*(.+?)\s*$/);
283 if (item) {
284 out.push(item[1]!.replace(/^['"]|['"]$/g, ''));
285 continue;
286 }
287 // A non-list, non-blank line ends the `packages:` block.
288 if (line.trim() !== '' && !/^\s/.test(line)) inPackages = false;
289 }
290 }
291 return out;
292}
293
294/** Expand one level of a `packages/*` / `apps/**` glob to member dirs. */
295function expandWorkspaceGlob(projectRoot: string, pattern: string): string[] {

Callers 1

readWorkspaceGlobsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected