---
title: 14. Building, Testing, and Deploying with the CLI
tags: Angular Getting Started
image:
---
# 14. Building, Testing, and Deploying with the CLI
[toc]
<br/>
## Download Angular cli
>npm install -g @angular/cli
<br/>
## Angular cli command syntax
> ng [command] <args> --[options]
<br/>
## Common cli command
#### Generate a new angular app
> ng new [appName]
<br/>
#### Serving the app
> ng serve (or npm start)
<br/>
#### Generating code
> ng g ~
<br/>
##### ng generate Examples
<br/>
* Components
> ng g c [componentName]
<br/>
* Directives
> ng g d [directiveName]
<br/>
* Route guards
> ng g g [guardName]
<br/>
* Interfaces
> ng g i [interfaceName]
<br/>
* Modules
> ng g m [moduleName]
<br/>
* Pipes
> ng g p [pipeName]
<br/>
* Services
> ng g s [serviceName]
<br/>
#### Testing the app
> ng test
<br/>
#### Building the app
> ng build

<br/>
-------------------------------------------------------------------
<br/>
<br/>
