ng build
The ng build command is intended to prepare your application bundle to be executed by the production web server of your choice.
It performs a series of optimizations to guarantee the delivery of the smallest possible bundle of your application.
This results in a performance gain since with a smaller bundle, your client downloads faster, which is important, especially in environments with slow internet.
We will discuss this command in more detail in Chapter 12, Packaging Everything – Best Practices for Deployment.
ng deploy
The ng deploy command allows you to fully deploy your application to a cloud provider such as Microsoft Azure.
This command works together with the Angular library of the provider you want to use, so for it to work, you need to install it.
We will discuss this command in more detail in Chapter 12, Packaging Everything – Best Practices for Deployment.
ng generate
The ng generate command has the function to generate almost all types of Angular components that your application can use. This function brings a productivity gain in your workflow as it generates all the necessary files.
Let’s generate our about page in our example project with the following command:
ng generate component about
We can analyze in our project folders that the Angular CLI created the TypeScript, HTML, and CSS files necessary for rendering the component.
However, it also generated the unit test file for this component and updated the module for its use. All these files already have the minimum boilerplate for the development of the component.
In addition to generating practically all standard Angular components, this command can be used by external libraries that want to provide this development experience, as in the following example of Angular Material:
ng generate @angular/material:navigation home
In almost every chapter of the book, we’ll use this command to generate the components we’re going to study and the best practices and patterns for them.
Summary
In this chapter, we covered the features and philosophy of Angular and how to start a project in the most productive way. We learned which technologies make up its ecosystem and how to configure its desktop with the best VS Code extensions and settings. Finally, we learned how to start a project with the Angular CLI and what other features this powerful tool can provide us with.
Now you’ll be able to argue why to use Angular in your team’s project and you’ll be able to help it set up a productive work environment. You’ll also be able to use the Angular CLI to create and maintain your project.
In the next chapter, we will learn how to organize the components of an Angular application.