Creating a monorepo application using Nx
Nx provides developers with tools for working with monorepos, including the following:
- create-nx-workspace: An npm package that scaffolds a new Nx monorepo application.
- Nx CLI: A command-line interface that runs commands against a monorepo application. Nx CLI extends the Angular CLI to provide more commands, which is faster due to the distributed caching mechanism.
It is recommended to use the Quick Open feature of VSCode when working with Nx monorepos. The number of generated folders and files will significantly increase, and it will be challenging to navigate through them. You can find out more at https://code.visualstudio.com/docs/editor/editingevolved#_quick-file-navigation.
To install Nx CLI, run the following command in a terminal:
npm install -g nx
The preceding command will install the nx
npm package globally on our system. We can now scaffold a new Nx monorepo workspace using the following command:
npx create-nx-workspace packt...