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 schematics collection:
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 contains the following files:
collection.json
: A JSON schema that describes the schematics that belong to themy-schematics
collectionmy-schematics\index.ts
: The main entry point of themy-schematics
schematicmy-schematics\index_spec.ts
: The unit test file of the main entry point of themy-schematics
schematic
The JSON schema file of the collection contains...