In this article, we are going to learn what the different types of Angular CLI commands are, and the tools that power them. Let's get started.
There are three types of Angular CLI commands:
- schematics commands:
- architect commands:
- and native commands:
Schematics commands are commands that are based on a tool called
Schematics that comes from the
Schematics helps the Angular CLI scaffold a new Angular workspace (
ng new), generate blueprints (
ng generate), update/migrate existing code (
ng update), and add some frameworks support to an Angular application (
ng add). It's all about code generation.
The nice thing about
Schematics is that it allows us to extend the CLI's scaffolding capabilities.
Architect commands are commands that are based on a tool called
Architect that comes from the
Architect helps the Angular CLI lint (
ng lint), test (
ng e2e), serve (
ng serve), and build (
ng build) our Angular applications and libraries. It's all about running complex tasks.
Architect tool, we can now create custom tasks for the Angular CLI. Previously one would eject the Webpack configuration of the Angular CLI - using
ng eject - to be able to tweak the build process. Now every customization can be done using
Architect. That's why, the
eject command will be removed in Angular CLI 8.0.
Native commands are general Angular CLI commands. They are native to the Angular CLI in the sense that they don't rely on other tools/packages to be executed. Displaying our packages' versions (
ng version), opening the official documentation (
ng doc), reading and setting some values in the
angular.json file (
ng config) do not require the use any specific tool.
In this article, we learned that they were 3 types of Angular CLI commands: native commands, schematics commands, and architect commands.
Architect are tools from the
@angular-devkit package that make the Angular CLI generic, extensible, and so powerful.
If you enjoyed this article, follow @ahasall on Twitter for more content like this.