Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nrwl/nx
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 19.5.5
Choose a base ref
...
head repository: nrwl/nx
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 19.5.6
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Aug 1, 2024

  1. fix(misc): add cloud token during new workspace like expected (#27265)

    <!-- 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 -->
    
    The nx cloud access token is not written to nx.json during
    `create-nx-workspace`
    
    ## Expected Behavior
    <!-- This is the behavior we should expect with the changes in this PR
    -->
    
    The nx cloud access token is written to nx.json during
    `create-nx-workspace`
    
    ## Related Issue(s)
    <!-- Please link the issue being fixed so it gets closed when this is
    merged. -->
    
    Fixes #
    
    (cherry picked from commit dacf0b0)
    FrozenPandaz committed Aug 1, 2024
    Copy the full SHA
    9332586 View commit details
Showing with 12 additions and 8 deletions.
  1. +8 −5 packages/create-nx-workspace/src/utils/nx/nx-cloud.ts
  2. +4 −3 packages/nx/src/command-line/connect/connect-to-nx-cloud.ts
13 changes: 8 additions & 5 deletions packages/create-nx-workspace/src/utils/nx/nx-cloud.ts
Original file line number Diff line number Diff line change
@@ -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;
7 changes: 4 additions & 3 deletions packages/nx/src/command-line/connect/connect-to-nx-cloud.ts
Original file line number Diff line number Diff line change
@@ -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;
}