Migrating an Angular CLI workspace to an Integrated Nx Monorepo
If you want to migrate your Angular CLI project to an Integrated Nx Monorepo, run the following command:
npx nx@latest init --integrated
The command applies the following changes to your workspace:
- Installs the
- Moves your applications into the
appsfolder, and updates the relevant file paths in your configuration files.
- Moves your e2e suites into the
apps/<app name>-e2efolder, and updates the relevant file paths in your configuration files.
- Moves your libraries into the
libsfolder, and updates the relevant file paths in your configuration files.
- Updates your
package.jsonscripts to use
- Splits your
project.jsonfiles for each project with updated paths.
After the changes are applied, your workspace file structure should look similar to the one below:
<workspace name>/ ├── apps/ │ └─ <app name>/ │ ├── src/ │ │ ├── app/ │ │ ├── assets/ │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── main.ts │ │ └── styles.css │ ├── project.json │ ├── tsconfig.app.json │ └── tsconfig.spec.json ├── libs/ │ └── <lib name>/ │ ├── src/ │ ├── ng-package.json │ ├── package.json │ ├── project.json │ ├── README.md │ ├── tsconfig.lib.json │ ├── tsconfig.lib.prod.json │ └── tsconfig.spec.json ├── tools/ ├── .editorconfig ├── .gitignore ├── .prettierignore ├── .prettierrc ├── karma.conf.js ├── nx.json ├── package.json ├── README.md └── tsconfig.base.json
Your workspace is now powered by Nx! You can verify that your application still runs as intended:
- To serve, run
nx serve <app name>.
- To build, run
nx build <app name>.
- To run unit tests, run
nx test <app name>.
- To see your project graph, run
Your project graph will grow as you add and use more applications and libraries. You can add the
nx graphto see the changes in-browser as you add them.
Older Versions of Angular
Support for workspaces with multiple applications and libraries was added in Nx v14.1.0. If you are migrating using an older version of Nx, your workspace can only contain one application and no libraries in order to use the automated migration, otherwise, you can still migrate manually.
Modified Folder Structure
The automated migration supports Angular CLI workspaces with a standard structure, configurations and features. If your workspace has deviated from what the Angular CLI generates, you might not be able to use the automated migration and you will need to manually migrate your workspace.
Currently, the automated migration supports workspaces using the following executors (builders):
Support for other executors may be added in the future.
Learn more about the advantages of Nx in the following guides: