Skip to content

Commit abfe5d9

Browse files
CammisuliFrozenPandaz
authored andcommitted
fix(core): update nx cloud bundle install directory logic (#29555)
1 parent 3ccec47 commit abfe5d9

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

packages/nx/src/nx-cloud/update-manager.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { cacheDir } from '../utils/cache-directory';
1919
import { createHash } from 'crypto';
2020
import { TasksRunner } from '../tasks-runner/tasks-runner';
2121
import { RemoteCacheV2 } from '../tasks-runner/default-tasks-runner';
22+
import { workspaceRoot } from '../utils/workspace-root';
2223

2324
interface CloudBundleInstall {
2425
version: string;
@@ -150,7 +151,26 @@ export async function verifyOrUpdateNxCloudClient(
150151
nxCloudClient: require(currentBundle.fullPath),
151152
};
152153
}
153-
const runnerBundleInstallDirectory = join(cacheDir, 'cloud');
154+
155+
function getBundleInstallDefaultLocation() {
156+
const legacyPath = join(
157+
workspaceRoot,
158+
'node_modules',
159+
'.cache',
160+
'nx',
161+
'cloud'
162+
);
163+
164+
// this legacy path is used when the nx-cloud package is installed.
165+
// make sure to reuse it so that we don't `require` different the client bundles
166+
if (existsSync(legacyPath)) {
167+
return legacyPath;
168+
} else {
169+
return join(cacheDir, 'cloud');
170+
}
171+
}
172+
173+
const runnerBundleInstallDirectory = getBundleInstallDefaultLocation();
154174

155175
function getLatestInstalledRunnerBundle(): CloudBundleInstall | null {
156176
if (!existsSync(runnerBundleInstallDirectory)) {

0 commit comments

Comments
 (0)