Skip to content

Commit

Permalink
feat(nx-cloud): configure import paths for light client when running …
Browse files Browse the repository at this point in the history
…login/logout
  • Loading branch information
lourw committed Oct 31, 2024
1 parent 1218502 commit 62285ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/nx/src/command-line/login/login.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -15,6 +16,10 @@ export function loginHandler(args: LoginArgs): Promise<number> {
return handleErrors(args.verbose, async () => {
const nxCloudClient = (await verifyOrUpdateNxCloudClient(getCloudOptions()))
.nxCloudClient;

const paths = findAncestorNodeModules(__dirname, []);
nxCloudClient.configureLightClientRequire()(paths);

await nxCloudClient.commands.login();
});
}
5 changes: 5 additions & 0 deletions packages/nx/src/command-line/logout/logout.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -10,6 +11,10 @@ export function logoutHandler(args: LogoutArgs): Promise<number> {
return handleErrors(args.verbose, async () => {
const nxCloudClient = (await verifyOrUpdateNxCloudClient(getCloudOptions()))
.nxCloudClient;

const paths = findAncestorNodeModules(__dirname, []);
nxCloudClient.configureLightClientRequire()(paths);

await nxCloudClient.commands.logout();
});
}

0 comments on commit 62285ba

Please sign in to comment.