Creating a Monorepo application using Angular CLI under 2 minutes
In this article, we create a monorepo application using Angular CLI. Before, please be assured that you already have @angular/cli installed on your computer. If you don’t have it or if you use an older version, follow the steps in this article to either install or upgrade it.
First step: Create a workspace.
A workspace contains all the applications and libraries inside the ‘projects’ folder. It’s nothing more than creating a standard Angular application with — createApplication=”false” argument.
ng generate sample-workspace — createApplication=”false”
Second step: First sample application in the Monorepo
Our project folder holds all our applications. Currently, it’s empty. Let’s create our first application using the commands below.
cd sample-workspace
ng new sample-app
Following the terminal prompts our first project to create in the projects folder.
What about a library?
Third step: We can create a library to be used in our sample application. Let’s do it!
ng generate library sample-lib
Considering we are in the sample applications workspace, these commands update the angular.json as well.
Last step:
Serve the project and visit http://localhost:4200 on your browser. Angular’s lovely sample application should greet you if everything operates adequately.