concept Angular CLI in category angular

appears as: Angular CLI, Angular CLI, The Angular CLI, The Angular CLI
Angular Development with Typescript, Second Edition

This is an excerpt from Manning's book Angular Development with Typescript, Second Edition.

1.4. Introducing Angular CLI

Angular CLI is a tool for managing Angular projects throughout the entire life-cycle of an application. It serves as a code generator that greatly simplifies the process of new-project creation as well as the process of generating new components, services, and routes in an existing app. You can also use Angular CLI for building code bundles for development and production deployment. Angular CLI will not only generate a boilerplate project for you, it will also install Angular framework and all its dependencies.

Angular CLI has become a de facto way of starting new Angular projects. You’ll install Angular CLI using the package manager npm. If you’re not familiar with package managers, read appendix C. To install Angular CLI globally on your computer so it can be used for multiple projects, run the following command in the Terminal window:

npm install @angular/cli -g

After the installation is complete, Angular CLI is ready to generate a new Angular project.

Testing Angular Applications

This is an excerpt from Manning's book Testing Angular Applications.

TypeScript compiles to JavaScript, and the Angular CLI will compile TypeScript automatically out of the box. If you’re familiar with JavaScript and have some knowledge of object-oriented programming (OOP), you should be able to pick up TypeScript quickly. If you’re new to OOP, that’s fine. It may just take a little more work for you to get up to speed.

In this book, you’ll use the Angular CLI to run tasks, execute tests, and manage dependencies. In this appendix, we’ll look at the Angular CLI, and you’ll install the tool itself. By installing the Angular CLI, you’ll also install Jasmine, Protractor, and Karma. When you’re finished with that, you’ll get the sample project up and running. Let’s dive in!

Updating an old version of the Angular CLI

If you have an old version of the Angular CLI already installed, you may have to take a couple of steps, depending on which version you have. The difference is that after version 1.0.0-beta.28, the name of the project, and its scope, was changed from angular-cli to @angular/cli. To find out which version you have installed, run the following command:

ng –v

In your terminal, you should see the current version of the Angular CLI that’s installed.

Angular in Action

This is an excerpt from Manning's book Angular in Action.

The Angular CLI is a wonderful tool that has an ever-growing list of capabilities. Over time, it will likely do many more things than I mention here, and perhaps the capabilities may change as well.

The Angular CLI (often just referred to as the CLI) is the official toolchain for building Angular applications that provide these features and more. This book uses the CLI for all examples, and you’re encouraged to use it for your projects as well. You could roll your own build tooling, but that’s suggested only if the CLI doesn’t meet your needs.

If you have custom needs, consider using the Angular CLI as part of the process instead of duplicating its behaviors, especially those related to how it builds the application. If you want to do additional processing after the build, better to do it after the CLI has run.