Skip to content

Commit

Permalink
docs(nx-cloud): update onboarding flow to use "nx connect"
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed Jul 5, 2024
1 parent a6522f7 commit 629c4e7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 31 deletions.
4 changes: 4 additions & 0 deletions docs/nx-cloud/intro/ci-with-nx.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Implementing an efficient CI setup for monorepos - while crucial - can be challe

[Create an account on Nx Cloud](https://cloud.nx.app) and connect your repository.

```shell
npx nx connect
```

## Learn about Nx on CI

{% cards cols="2" lgCols="4" mdCols="4" smCols="2" %}
Expand Down
19 changes: 15 additions & 4 deletions docs/nx-cloud/intro/why-nx-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ In a nutshell, here's how this works:

**Step 1: Connect your workspace to Nx Cloud**

This can be done by signing up on [nx.app](https://nx.app) and then connecting to your git repository. Read more about all the details [on this doc page](/ci/recipes/set-up/connect-to-cloud).
This can be done by signing up on [nx.app](https://nx.app) and then connecting to your git repository.

```shell
npx nx connect
```

**Step 2: Your CI script triggers Nx Cloud**

Expand All @@ -40,13 +44,20 @@ This can be done by signing up on [nx.app](https://nx.app) and then connecting t
run: 'npx nx-cloud start-ci-run --distribute-on="8 linux-medium-js"'
```
Check out our [recipes for the various CI providers](/ci/recipes/set-up).
Let us generate the workflow file for you.
```shell
npx nx g ci-workflow
```

Or, check out our [recipes for the various CI providers](/ci/recipes/set-up).

**Step 3: Run your Nx command as usual**
**Step 3: Run your Nx commands as usual**

```yml
- run: npx nx-cloud record -- nx format:check
- run: npx nx affected -t lint test build e2e-ci
- run: npx nx affected -t lint test build
- run: npx nx affected -t e2e-ci --parallel 1
```
All these commands are automatically picked up by Nx Cloud, split up into smaller tasks and distributed across the specified number of machines.
Expand Down
30 changes: 3 additions & 27 deletions docs/nx-cloud/recipes/connect-to-cloud.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,9 @@
# Connect to Nx Cloud

Create an account on [nx.app](https://nx.app). There are several ways to connect your repository to Nx Cloud.

#### Connect Directly Through GitHub

If your repository is hosted on GitHub, we recommend you create an Nx Cloud organization based on your GitHub organization.

![Connect Your VCS Account](/nx-cloud/tutorial/connect-vcs-account.png)

After that, connect you repository.

![Connect Your Repository](/nx-cloud/tutorial/connect-repository.png)

This will send a pull request to your repository that will add the `nxCloudAccessToken` property to `nx.json`.

![Nx Cloud Setup PR](/nx-cloud/tutorial/nx-cloud-setup-pr.png)

This wires up all the CI for you and configures access. Folks who can see your repository can see your workspace on nx.app.

## Manually Connect Your Workspace

If your repository is hosted on a different source control provider, you can also connect to Nx Cloud manually. You'll need to add a source control integration later to enable [Nx Agents](/ci/features/distribute-task-execution).

Run the following command in your repository:
Create an account on [nx.app](https://nx.app) and then connect to your git repository.

```shell
pnpm nx connect
npx nx connect
```

Click the link in the terminal to claim your workspace on [nx.app](https://nx.app).

The command generates an `nxCloudAccessToken` property inside of `nx.json`. This is a read-only token that should be committed to the repository.
Follow the prompts to finish the setup.

0 comments on commit 629c4e7

Please sign in to comment.