diff --git a/packages/nx/src/config/nx-json.ts b/packages/nx/src/config/nx-json.ts index 99d14ff39bc7b..49a94461b98db 100644 --- a/packages/nx/src/config/nx-json.ts +++ b/packages/nx/src/config/nx-json.ts @@ -182,3 +182,8 @@ export function readNxJson(root: string = workspaceRoot): NxJsonConfiguration { } } } + +export function hasNxJson(root: string): boolean { + const nxJson = join(root, 'nx.json'); + return existsSync(nxJson); +} diff --git a/packages/nx/src/config/workspaces.ts b/packages/nx/src/config/workspaces.ts index 1576a3ef84d76..340e60285a8a1 100644 --- a/packages/nx/src/config/workspaces.ts +++ b/packages/nx/src/config/workspaces.ts @@ -154,11 +154,6 @@ export class Workspaces { } return projects; } - - hasNxJson(): boolean { - const nxJson = path.join(this.root, 'nx.json'); - return existsSync(nxJson); - } } function findMatchingProjectInCwd( diff --git a/packages/nx/src/daemon/client/client.ts b/packages/nx/src/daemon/client/client.ts index 4eb0eb310c6ee..925d7d507f922 100644 --- a/packages/nx/src/daemon/client/client.ts +++ b/packages/nx/src/daemon/client/client.ts @@ -19,7 +19,7 @@ import { isCI } from '../../utils/is-ci'; import { NxJsonConfiguration } from '../../config/nx-json'; import { readNxJson } from '../../config/configuration'; import { PromisedBasedQueue } from '../../utils/promised-based-queue'; -import { Workspaces } from '../../config/workspaces'; +import { hasNxJson } from '../../config/nx-json'; import { Message, SocketMessenger } from './socket-messenger'; import { safelyCleanUpExistingProcess } from '../cache'; import { Hash } from '../../hasher/task-hasher'; @@ -438,7 +438,7 @@ function isDocker() { } function nxJsonIsNotPresent() { - return !new Workspaces(workspaceRoot).hasNxJson(); + return !hasNxJson(workspaceRoot); } function daemonProcessException(message: string) {