MCPcopy Create free account
hub / github.com/code-pushup/cli / hasWorkspacesEnabled

Function hasWorkspacesEnabled

packages/utils/src/lib/workspace-packages.ts:45–57  ·  view source on GitHub ↗
(cwd: string)

Source from the content-addressed store, hash-verified

43}
44
45export async function hasWorkspacesEnabled(cwd: string): Promise<boolean> {
46 const packageJson = await readRootPackageJson(cwd);
47 if (!packageJson.private) {
48 return false;
49 }
50 if (Array.isArray(packageJson.workspaces)) {
51 return packageJson.workspaces.length > 0;
52 }
53 if (typeof packageJson.workspaces === 'object') {
54 return Boolean(packageJson.workspaces.packages?.length);
55 }
56 return false;
57}
58
59export async function readRootPackageJson(cwd: string): Promise<PackageJson> {
60 return await readJsonFile<PackageJson>(path.join(cwd, 'package.json'));

Callers 2

monorepo.tsFile · 0.85

Calls 1

readRootPackageJsonFunction · 0.85

Tested by

no test coverage detected