DEV Community

Mini Bhati
Mini Bhati

Posted on

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>
Enter fullscreen mode Exit fullscreen mode

Add NPM packages

ng add <npm-package>
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Generate new Schematics

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

ng generate <schematic-name> <sample-name>
Enter fullscreen mode Exit fullscreen mode

Build the Angular app

Compiles the application under the output directory named /dist

ng build
Enter fullscreen mode Exit fullscreen mode

Run Unit tests in the app

ng test
Enter fullscreen mode Exit fullscreen mode

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

Top comments (0)