diff --git a/packages/create-nx-workspace/src/utils/nx/nx-cloud.ts b/packages/create-nx-workspace/src/utils/nx/nx-cloud.ts index 96833e668a80d..0f6703c6128ff 100644 --- a/packages/create-nx-workspace/src/utils/nx/nx-cloud.ts +++ b/packages/create-nx-workspace/src/utils/nx/nx-cloud.ts @@ -21,11 +21,14 @@ export async function setupNxCloud( // nx-ignore-next-line )) as typeof import('nx/src/command-line/connect/connect-to-nx-cloud'); - const accessToken = await connectWorkspaceToCloud({ - installationSource: 'create-nx-workspace', - directory, - github: useGitHub, - }); + const accessToken = await connectWorkspaceToCloud( + { + installationSource: 'create-nx-workspace', + directory, + github: useGitHub, + }, + directory + ); nxCloudSpinner.succeed('Nx Cloud has been set up successfully'); return accessToken; 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 60506869cfbb7..1dd4528338c86 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 @@ -56,12 +56,13 @@ export async function connectToNxCloudIfExplicitlyAsked( } export async function connectWorkspaceToCloud( - options: ConnectToNxCloudOptions + options: ConnectToNxCloudOptions, + directory = workspaceRoot ) { - const tree = new FsTree(workspaceRoot, false, 'connect-to-nx-cloud'); + const tree = new FsTree(directory, false, 'connect-to-nx-cloud'); const accessToken = await connectToNxCloud(tree, options); tree.lock(); - flushChanges(workspaceRoot, tree.listChanges()); + flushChanges(directory, tree.listChanges()); return accessToken; }