From fa81e3bcab7d10b501363721d1bdde373ee10d08 Mon Sep 17 00:00:00 2001 From: Craigory Coppola Date: Wed, 27 Apr 2022 18:01:50 -0400 Subject: [PATCH] fix(core): allow daemon to disable glob cache (#10031) --- packages/nx/src/config/workspaces.ts | 6 +++++- packages/nx/src/daemon/client/client.ts | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/nx/src/config/workspaces.ts b/packages/nx/src/config/workspaces.ts index c09ef1df894e7..6b70d77c3343e 100644 --- a/packages/nx/src/config/workspaces.ts +++ b/packages/nx/src/config/workspaces.ts @@ -505,7 +505,11 @@ export function globForProjectFiles( ) { // Deal w/ Caching const cacheKey = [root, ...(nxJson?.plugins || [])].join(','); - if (projectGlobCache && cacheKey === projectGlobCacheKey) + if ( + process.env.NX_PROJECT_GLOB_CACHE !== 'false' && + projectGlobCache && + cacheKey === projectGlobCacheKey + ) return projectGlobCache; projectGlobCacheKey = cacheKey; diff --git a/packages/nx/src/daemon/client/client.ts b/packages/nx/src/daemon/client/client.ts index 8c882cbfc4c87..533d9e3738435 100644 --- a/packages/nx/src/daemon/client/client.ts +++ b/packages/nx/src/daemon/client/client.ts @@ -17,6 +17,11 @@ import { } from '../tmp-dir'; import { ProjectGraph } from '../../config/project-graph'; +const DAEMON_ENV_SETTINGS = { + ...process.env, + NX_PROJECT_GLOB_CACHE: 'false', +}; + export async function startInBackground(): Promise { await safelyCleanUpExistingProcess(); ensureDirSync(DAEMON_DIR_FOR_CURRENT_WORKSPACE); @@ -33,6 +38,7 @@ export async function startInBackground(): Promise { detached: true, windowsHide: true, shell: false, + env: DAEMON_ENV_SETTINGS, } ); backgroundProcess.unref(); @@ -92,6 +98,7 @@ export function startInCurrentProcess(): void { spawnSync(process.execPath, [join(__dirname, '../server/start.js')], { cwd: workspaceRoot, stdio: 'inherit', + env: DAEMON_ENV_SETTINGS, }); }