Angular CLI
What is Angular CLI ?
a Command-line interface tool used to initialize develop scaffold and maintain Angular application directly from a command shell ( CMD PowerShell .. )
To install Angular CLI we run this command inside CMD :
npm install -g @angular/cli
Angular CLI Features :
ng serve
this command builds, deploys, and serves the application.
If we change something in the code it will automatically serve that code
ng test
this command is used to run Unit tests in the angular project
General :
ng test <project> [options] OR ng t <project> [options]
ng new
this command allows creating a new Angular project with all dependencies installed in the node_modules folder
ng new Project-Name
ng generate
this is the most used one. It is used to create anything in the application :
Class :
ng generate class <name> [options ]
Component :
ng generate component <component-name> [options]
directive :
ng generate directive <name> [options]
enum :
ng generate enum <name> [options]
guard :
ng generate guard <name> [options]
interface :
ng generate interface <name> [options]
library
ng generate library <name> [options]
module
ng generate module <name> [options]
pipe:
ng generate pipe <name> [options]
service:
ng generate service <name> [options]
service worker :
ng generate serviceWorker [options]
web worker:
ng generate webWorker <name> [options]
Universal :
ng generate universal [options]
ng e2e
this command will launch end-to-end testing(E2E) of our Angular project.
E2E testing is performed either with Protractor (the default one — created by the Angular team )or Cypress
ng e2e [project] | ng e [project]
ng build
this command is used to build our project
ng build --prod
Conclusion
In this guide, we learned what the Angular CLI is and why we should always use it to save time ( Developers 🐱👤 ).
There are tons of other options inside the Angular CLI that developers mostly will benefit from.
happy to see you reading this phrase .
Follow me for other featured posts