docs(angular): update ng add section in angular cli comparison (#22542)

This commit is contained in:
Leosvel Pérez Espinosa 2024-04-02 17:07:58 +02:00 committed by GitHub
parent de2df18e9d
commit afc324d3f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -191,16 +191,43 @@ What's the difference?
To reiterate: `nx migrate` runs the migrations written by the Angular team the same way `ng update` runs them. So everything should still work. You just get more control over how it works. You can learn more in our docs about [Automate Updating Dependencies](/features/automate-updating-dependencies).
### 'ng add'
### 'nx add'
`ng add` is not natively supported by Nx. We want a consistent package install experience for developers working with Angular or non-Angular packages.
The [`nx add` command](/nx-api/nx/documents/add) is similar to the `ng add` command. It installs a given package specifier (e.g. `@nx/react`, `@nx/react@18.1.0`, `@nx/react@latest`) and it runs an `init` or `ng-add` generator if the installed package contains it.
Instead, we recommend running:
This command was introduced in **Nx 17.3.0**.
If you're using a version of Nx older than **17.3.0**, we recommend running:
{% tabs %}
{% tab label="npm" %}
```shell
npm install [package] && nx g [package]:ng-add
npm add [package]
nx g [package]:ng-add
```
{% /tab %}
{% tab label="yarn" %}
```shell
yarn add [package]
nx g [package]:ng-add
```
{% /tab %}
{% tab label="pnpm" %}
```shell
pnpm add [package]
nx g [package]:ng-add
```
{% /tab %}
{% /tabs %}
Replace `[package]` with the package name you're trying to add.
### Speed