From 62285ba9cc15e1475ee6628c744a12ba595d0ae9 Mon Sep 17 00:00:00 2001 From: lourw <56288712+lourw@users.noreply.github.com> Date: Thu, 31 Oct 2024 12:29:27 -0700 Subject: [PATCH] feat(nx-cloud): configure import paths for light client when running login/logout --- packages/nx/src/command-line/login/login.ts | 5 +++++ packages/nx/src/command-line/logout/logout.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/packages/nx/src/command-line/login/login.ts b/packages/nx/src/command-line/login/login.ts index 6b8c74ef51ec1f..6b538f223a1058 100644 --- a/packages/nx/src/command-line/login/login.ts +++ b/packages/nx/src/command-line/login/login.ts @@ -1,6 +1,7 @@ import { verifyOrUpdateNxCloudClient } from '../../nx-cloud/update-manager'; import { getCloudOptions } from '../../nx-cloud/utilities/get-cloud-options'; import { handleErrors } from '../../utils/handle-errors'; +import { findAncestorNodeModules } from 'nx/src/nx-cloud/resolution-helpers'; export interface LoginArgs { nxCloudUrl?: string; @@ -15,6 +16,10 @@ export function loginHandler(args: LoginArgs): Promise { return handleErrors(args.verbose, async () => { const nxCloudClient = (await verifyOrUpdateNxCloudClient(getCloudOptions())) .nxCloudClient; + + const paths = findAncestorNodeModules(__dirname, []); + nxCloudClient.configureLightClientRequire()(paths); + await nxCloudClient.commands.login(); }); } diff --git a/packages/nx/src/command-line/logout/logout.ts b/packages/nx/src/command-line/logout/logout.ts index 1e5b49035dcd9e..73bf8c7130b1df 100644 --- a/packages/nx/src/command-line/logout/logout.ts +++ b/packages/nx/src/command-line/logout/logout.ts @@ -1,6 +1,7 @@ import { verifyOrUpdateNxCloudClient } from '../../nx-cloud/update-manager'; import { getCloudOptions } from '../../nx-cloud/utilities/get-cloud-options'; import { handleErrors } from '../../utils/handle-errors'; +import { findAncestorNodeModules } from 'nx/src/nx-cloud/resolution-helpers'; export interface LogoutArgs { verbose?: boolean; @@ -10,6 +11,10 @@ export function logoutHandler(args: LogoutArgs): Promise { return handleErrors(args.verbose, async () => { const nxCloudClient = (await verifyOrUpdateNxCloudClient(getCloudOptions())) .nxCloudClient; + + const paths = findAncestorNodeModules(__dirname, []); + nxCloudClient.configureLightClientRequire()(paths); + await nxCloudClient.commands.logout(); }); }