From 8464d80c7c99f9478e3add700a7e2e0e90a7364b Mon Sep 17 00:00:00 2001 From: MaxKless <34165455+MaxKless@users.noreply.github.com> Date: Tue, 6 Aug 2024 15:04:44 +0200 Subject: [PATCH] feat(core): add nx-console installation source to nx connect (#27307) --- .../nx/src/command-line/connect/connect-to-nx-cloud.ts | 8 ++++++-- .../generators/connect-to-nx-cloud/connect-to-nx-cloud.ts | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/nx/src/command-line/connect/connect-to-nx-cloud.ts b/packages/nx/src/command-line/connect/connect-to-nx-cloud.ts index 1dd4528338c86..6b1f79741fbbd 100644 --- a/packages/nx/src/command-line/connect/connect-to-nx-cloud.ts +++ b/packages/nx/src/command-line/connect/connect-to-nx-cloud.ts @@ -71,6 +71,10 @@ export async function connectToNxCloudCommand( ): Promise { const nxJson = readNxJson(); + const installationSource = process.env.NX_CONSOLE + ? 'nx-console' + : 'nx-connect'; + if (isNxCloudUsed(nxJson)) { const token = process.env.NX_CLOUD_ACCESS_TOKEN || nxJson.nxCloudAccessToken; @@ -80,7 +84,7 @@ export async function connectToNxCloudCommand( ); } const connectCloudUrl = await createNxCloudOnboardingURL( - 'nx-connect', + installationSource, token ); output.log({ @@ -96,7 +100,7 @@ export async function connectToNxCloudCommand( return false; } const token = await connectWorkspaceToCloud({ - installationSource: command ?? 'nx-connect', + installationSource: command ?? installationSource, }); const connectCloudUrl = await createNxCloudOnboardingURL('nx-connect', token); diff --git a/packages/nx/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.ts b/packages/nx/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.ts index a7c9fd1876957..8e1eb8aa2afc6 100644 --- a/packages/nx/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.ts +++ b/packages/nx/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.ts @@ -146,7 +146,13 @@ export async function connectToNxCloud( // do NOT create Nx Cloud token (createNxCloudWorkspace) // if user is using github and is running nx-connect - if (!(usesGithub && schema.installationSource === 'nx-connect')) { + if ( + !( + usesGithub && + (schema.installationSource === 'nx-connect' || + schema.installationSource === 'nx-console') + ) + ) { responseFromCreateNxCloudWorkspace = await createNxCloudWorkspace( getRootPackageName(tree), schema.installationSource,