List of Angular CLI commands we use daily

In this post, I am consolidating all the commonly used Angular CLI commands which every Angular developer uses frequently.

Create a NEW angular project

ng new <project-name>

ng n <project-name>

Add NPM packages

ng add <npm-package>

Run the Angular project

The application is run on port 4200 by default. You can specify the port in the following command using --port flag.

ng serve

Generate new Schematics

Schematics can be directives, components, pipes, modules, guards etc

ng generate <schematic-name> <sample-name>

Build the Angular app

Compiles the application under the output directory named /dist

ng build

Run Unit tests in the app

ng test

And, that's it for today. Would you like to add anything else to the list?

67