Skip to content

Commit a22a431

Browse files
authored
feat(nx-cloud): configure import paths for light client when running … (#28735)
…login/logout <!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> When you call `nx login` and `nx logout`, we did not pass in import paths to node modules so the displayed messages for each command were just raw text. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> When you call `login` or `logout`, you get formatting on the command output. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
1 parent a5920e3 commit a22a431

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/nx/src/command-line/login/login.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { verifyOrUpdateNxCloudClient } from '../../nx-cloud/update-manager';
22
import { getCloudOptions } from '../../nx-cloud/utilities/get-cloud-options';
33
import { handleErrors } from '../../utils/handle-errors';
4+
import { findAncestorNodeModules } from '../../nx-cloud/resolution-helpers';
45

56
export interface LoginArgs {
67
nxCloudUrl?: string;
@@ -15,6 +16,10 @@ export function loginHandler(args: LoginArgs): Promise<number> {
1516
return handleErrors(args.verbose, async () => {
1617
const nxCloudClient = (await verifyOrUpdateNxCloudClient(getCloudOptions()))
1718
.nxCloudClient;
19+
20+
const paths = findAncestorNodeModules(__dirname, []);
21+
nxCloudClient.configureLightClientRequire()(paths);
22+
1823
await nxCloudClient.commands.login();
1924
});
2025
}

packages/nx/src/command-line/logout/logout.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { verifyOrUpdateNxCloudClient } from '../../nx-cloud/update-manager';
22
import { getCloudOptions } from '../../nx-cloud/utilities/get-cloud-options';
33
import { handleErrors } from '../../utils/handle-errors';
4+
import { findAncestorNodeModules } from '../../nx-cloud/resolution-helpers';
45

56
export interface LogoutArgs {
67
verbose?: boolean;
@@ -10,6 +11,10 @@ export function logoutHandler(args: LogoutArgs): Promise<number> {
1011
return handleErrors(args.verbose, async () => {
1112
const nxCloudClient = (await verifyOrUpdateNxCloudClient(getCloudOptions()))
1213
.nxCloudClient;
14+
15+
const paths = findAncestorNodeModules(__dirname, []);
16+
nxCloudClient.configureLightClientRequire()(paths);
17+
1318
await nxCloudClient.commands.logout();
1419
});
1520
}

0 commit comments

Comments
 (0)