Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): update nx cloud bundle install directory logic #29555

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion packages/nx/src/nx-cloud/update-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { cacheDir } from '../utils/cache-directory';
import { createHash } from 'crypto';
import { TasksRunner } from '../tasks-runner/tasks-runner';
import { RemoteCacheV2 } from '../tasks-runner/default-tasks-runner';
import { workspaceRoot } from '../utils/workspace-root';

interface CloudBundleInstall {
version: string;
Expand Down Expand Up @@ -150,7 +151,26 @@ export async function verifyOrUpdateNxCloudClient(
nxCloudClient: require(currentBundle.fullPath),
};
}
const runnerBundleInstallDirectory = join(cacheDir, 'cloud');

function getBundleInstallDefaultLocation() {
const legacyPath = join(
workspaceRoot,
'node_modules',
'.cache',
'nx',
'cloud'
);

// this legacy path is used when the nx-cloud package is installed.
// make sure to reuse it so that we don't `require` different the client bundles
if (existsSync(legacyPath)) {
return legacyPath;
} else {
return join(cacheDir, 'cloud');
}
}

const runnerBundleInstallDirectory = getBundleInstallDefaultLocation();

function getLatestInstalledRunnerBundle(): CloudBundleInstall | null {
if (!existsSync(runnerBundleInstallDirectory)) {
Expand Down
Loading