From 3e370e06c4104868bb78aae3ae9b9f8368dcdd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leosvel=20P=C3=A9rez=20Espinosa?= Date: Tue, 15 Mar 2022 10:49:49 +0000 Subject: [PATCH 1/3] docs(angular): update angular cli migration docs to reflect the generator relocation to @nrwl/angular --- docs/shared/migration/migration-angular.md | 29 ++++++++++++++++------ 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/docs/shared/migration/migration-angular.md b/docs/shared/migration/migration-angular.md index 6a464cea81566..704b7b454b2d8 100644 --- a/docs/shared/migration/migration-angular.md +++ b/docs/shared/migration/migration-angular.md @@ -6,21 +6,27 @@ using a monorepo approach. If you are currently using an Angular CLI workspace, ## Prerequisites - The major version of your `Angular CLI` must align with the version of `Nx` you are upgrading to. For example, if you're using Angular CLI version 7, you must transition using the latest version 7 release of Nx. -- Currently, transforming an Angular CLI workspace to an Nx workspace automatically only supports a single project. If you have more than one project in your Angular CLI workspace, you can still migrate manually. +- Currently, transforming an Angular CLI workspace to an Nx workspace automatically only supports a single project. If you have more than one project in your Angular CLI workspace, you can still [migrate manually](#transitioning-manually). ## Using the Nx CLI while preserving the existing structure To use the Nx CLI in an existing Angular CLI workspace while keeping your existing file structure in place, use the `ng add` command with the `--preserve-angular-cli-layout` option: ```bash -ng add @nrwl/workspace --preserve-angular-cli-layout +ng add @nrwl/angular --preserve-angular-cli-layout ``` -> **Note**: If you are migrating to an Nx versions previous to `v13.8.4` (e.g. `ng add @nrwl/workspace@12`) use the `--preserveAngularCLILayout` option instead. +**Note**: If you specify a version of Nx (e.g. `ng add @nrwl/angular@13.9.0`), please make sure to use the appropriate command as shown in the compatibility table below: -This installs the `@nrwl/workspace` package into your workspace and applies the following changes to your workspace: +| Nx version | Collection to use | Flag to use | Example | +| ------------------ | ----------------- | ------------------------------- | ------------------------------------------------------------- | +| >= 13.9.0 | `@nrwl/angular` | `--preserve-angular-cli-layout` | `ng add @nrwl/angular@13.9.0 --preserve-angular-cli-layout` | +| >= 13.8.4 < 13.9.0 | `@nrwl/workspace` | `--preserve-angular-cli-layout` | `ng add @nrwl/workspace@13.8.4 --preserve-angular-cli-layout` | +| < 13.8.4 | `@nrwl/workspace` | `--preserveAngularCLILayout` | `ng add @nrwl/workspace@13.5.0 --preserveAngularCLILayout` | -- Adds and installs the `@nrwl/workspace` package in your development dependencies. +This installs the `@nrwl/angular` (or `nrwl/workspace`) package into your workspace and runs a generator (or schematic) to make following changes: + +- Installs the `nx` and `nrwl/workspace` packages. - Creates an `nx.json` file in the root of your workspace. - Adds a `decorate-angular-cli.js` to the root of your workspace, and a `postinstall` script in your `package.json` to run the script when your dependencies are updated. The script forwards the `ng` commands to the Nx CLI (`nx`) to enable features such as [Computation Caching](/using-nx/caching). @@ -31,12 +37,19 @@ After the process completes, you can continue using the same `serve/build/lint/t To transform an Angular CLI workspace to an Nx workspace, run the following command: ```bash -ng add @nrwl/workspace +ng add @nrwl/angular ``` -This installs the `@nrwl/workspace` package into your workspace and runs a generator (or schematic) to transform your workspace. The generator applies the following changes to your workspace: +**Note**: If you specify a version of Nx (e.g. `ng add @nrwl/angular@13.9.0`), please make sure to use the appropriate command as shown in the compatibility table below: + +| Nx version | Command to run | +| ---------- | ------------------------ | +| >= 13.9.0 | `ng add @nrwl/angular` | +| < 13.9.0 | `ng add @nrwl/workspace` | + +This installs the `@nrwl/angular` (or `nrwl/workspace`) package into your workspace and runs a generator (or schematic) to transform your workspace. The generator applies the following changes to your workspace: -- Installs the packages for the `Nx` plugin `@nrwl/angular` in your `package.json`. +- Installs the `nx` and `@nrwl/workspace` packages. - Creates an `nx.json` file in the root of your workspace. - Creates configuration files for Prettier. - Creates an `apps` folder for generating applications. From 558193086f546143a3fa2aa13ee5aeeeafb20200 Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Fri, 18 Mar 2022 17:22:39 -0400 Subject: [PATCH 2/3] chore: add @ --- docs/shared/migration/migration-angular.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/shared/migration/migration-angular.md b/docs/shared/migration/migration-angular.md index 704b7b454b2d8..6469bf9568270 100644 --- a/docs/shared/migration/migration-angular.md +++ b/docs/shared/migration/migration-angular.md @@ -26,7 +26,7 @@ ng add @nrwl/angular --preserve-angular-cli-layout This installs the `@nrwl/angular` (or `nrwl/workspace`) package into your workspace and runs a generator (or schematic) to make following changes: -- Installs the `nx` and `nrwl/workspace` packages. +- Installs the `nx` and `@nrwl/workspace` packages. - Creates an `nx.json` file in the root of your workspace. - Adds a `decorate-angular-cli.js` to the root of your workspace, and a `postinstall` script in your `package.json` to run the script when your dependencies are updated. The script forwards the `ng` commands to the Nx CLI (`nx`) to enable features such as [Computation Caching](/using-nx/caching). From d380d32def42015d9eb62591f7567f6075ecd137 Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Fri, 18 Mar 2022 17:22:46 -0400 Subject: [PATCH 3/3] chore: add @ --- docs/shared/migration/migration-angular.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/shared/migration/migration-angular.md b/docs/shared/migration/migration-angular.md index 6469bf9568270..da7d2c0f1e365 100644 --- a/docs/shared/migration/migration-angular.md +++ b/docs/shared/migration/migration-angular.md @@ -24,7 +24,7 @@ ng add @nrwl/angular --preserve-angular-cli-layout | >= 13.8.4 < 13.9.0 | `@nrwl/workspace` | `--preserve-angular-cli-layout` | `ng add @nrwl/workspace@13.8.4 --preserve-angular-cli-layout` | | < 13.8.4 | `@nrwl/workspace` | `--preserveAngularCLILayout` | `ng add @nrwl/workspace@13.5.0 --preserveAngularCLILayout` | -This installs the `@nrwl/angular` (or `nrwl/workspace`) package into your workspace and runs a generator (or schematic) to make following changes: +This installs the `@nrwl/angular` (or `@nrwl/workspace`) package into your workspace and runs a generator (or schematic) to make following changes: - Installs the `nx` and `@nrwl/workspace` packages. - Creates an `nx.json` file in the root of your workspace.