Installing the Schematics CLI
The Schematics CLI is a command-line interface that we can use to interact with the Schematics API. To install it, run the following npm
command:
npm install -g @angular-devkit/schematics-cli
The preceding command will install the @angular-devkit/schematics-cli
npm package globally on our system. We can then use the schematics
executable to create a new collection for the schematics:
schematics blank my-schematics
The previous command will generate a schematics project called my-schematics
. It contains a schematic with the same name by default inside the src
folder. A schematic includes the following files:
collection.json
: A JSON schema that describes the schematics that belong to themy-schematics
collection.my-schematics\index.ts
: The main entry point of the schematic.my-schematics\index_spec.ts
: The unit test file of the main entry point of the schematic.
The JSON schema file of the collection contains...