MCPcopy Index your code
hub / github.com/code-pushup/cli / listPackages

Function listPackages

packages/utils/src/lib/workspace-packages.ts:13–30  ·  view source on GitHub ↗
(
  cwd: string,
  patterns: string[] = ['**'],
)

Source from the content-addressed store, hash-verified

11};
12
13export async function listPackages(
14 cwd: string,
15 patterns: string[] = ['**'],
16): Promise<WorkspacePackage[]> {
17 const files = await glob(
18 patterns.map(pattern => pattern.replace(/\/?$/, '/package.json')),
19 { cwd },
20 );
21
22 return Promise.all(
23 files.toSorted().map(async (file): Promise<WorkspacePackage> => {
24 const packageJson = await readJsonFile<PackageJson>(path.join(cwd, file));
25 const directory = path.join(cwd, path.dirname(file));
26 const name = packageJson.name || path.basename(directory);
27 return { name, directory, packageJson };
28 }),
29 );
30}
31
32export async function listWorkspaces(
33 cwd: string,

Callers 5

listPnpmProjectsFunction · 0.90
listProjectsFunction · 0.90
listWorkspacesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected