Skip to content

Commit

Permalink
docs(core): update installation page (#22422)
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacplmann authored Mar 21, 2024
1 parent 10460ff commit a837f7f
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 10 deletions.
41 changes: 41 additions & 0 deletions docs/shared/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,48 @@ pnpm add --global nx@latest

The advantage of a global installation is that you don't have to prefix your commands with npx, yarn or pnpm. The global Nx installation hands off the process execution to the local Nx installation in your repository, which eliminates any issues with outdated globally installed packages.

## Install Nx in a Non-Javascript Repo

Nx can manage its own installation without requiring a `package.json` file or a `node_modules` folder. This type of installation is useful for repositories that may not contain any JavaScript or TypeScript (e.g. .Net or Java based workspaces that want to leverage Nx features). In this setup, the Nx CLI is all contained within a `.nx` folder. To set this up run the `nx init` command in a folder without a `package.json` file.

```shell
npx nx init
```

See the [install Nx in a non-javascript repo](/recipes/installation/install-non-javascript) recipe for more information.

## Update Nx

When you update Nx, Nx will also [automatically update your dependencies](/features/automate-updating-dependencies) if you have an [Nx plugin](/concepts/nx-plugins) installed for that dependency. To update Nx, run:

```shell
npx nx migrate latest
```

This will create a `migrations.json` file with any update scripts that need to be run. Run them with:

```shell
npx nx migrate --run-migrations
```

{% callout title="Update One Major Version at a Time" %}
To avoid potential issues, it is recommended to update one major version of Nx at a time.
{% /callout %}

## Tutorials

Try one of these tutorials for a full walkthrough of what to do after you install Nx

- [NPM Workspaces Tutorial](/getting-started/tutorials/npm-workspaces-tutorial)
- [Single React App Tutorial](/getting-started/tutorials/react-standalone-tutorial)
- [Single Angular App Tutorial](/getting-started/tutorials/angular-standalone-tutorial)
- [Single Vue App Tutorial](/getting-started/tutorials/vue-standalone-tutorial)
- [React Monorepo Tutorial](/getting-started/tutorials/react-standalone-tutorial)
- [Angular Monorepo Tutorial](/getting-started/tutorials/angular-standalone-tutorial)

## More Documentation

- [Add Nx to an Existing Repository](/recipes/adopting-nx)
- [Update Nx](/features/automate-updating-dependencies)
- [Update Your Global Nx Installation](/recipes/installation/update-global-installation)
- [Install Nx in a Non-Javascript Repo](/recipes/installation/install-non-javascript)
24 changes: 14 additions & 10 deletions docs/shared/recipes/installation/install-non-javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,39 @@ Nx can manage its own installation without requiring a `package.json` file or a

## Usage

You can install Nx in the `.nx/installation` directory by running `nx init` in a directory without package.json, and picking to install Nx in the current directory.
You can install Nx in the `.nx/installation` directory by running `nx init` in a directory without a `package.json` file.

```shell
npx nx init
```

When Nx is installed in `.nx`, you can run Nx via a global Nx installation or the nx and nx.bat scripts that were created. In either case, the wrapper (.nx/nxw.js) will be invoked and ensure that the current workspace is up to date prior to invoking Nx.

{% tabs %}
{% tab label="Global Install" %}

```shell
> nx build my-project
> nx generate application
> nx graph
nx build my-project
nx generate application
nx graph
```

{% /tab %}
{% tab label="nx shell script" %}

```shell
> ./nx build my-project
> ./nx generate application
> ./nx graph
./nx build my-project
./nx generate application
./nx graph
```

{% /tab %}
{% tab label="nx.bat" %}

```shell
> ./nx.bat build my-project
> ./nx.bat generate application
> ./nx.bat graph
./nx.bat build my-project
./nx.bat generate application
./nx.bat graph
```

{% /tab %}
Expand Down

0 comments on commit a837f7f

Please sign in to comment.