How do you create schematics for libraries?
You can create your own schematic collections to integrate your library with the Angular CLI. These collections are classified as 3 main schematics,
- Add schematics: These schematics are used to install library in an Angular workspace using
ng addcommand. For example, @angular/material schematic tells the add command to install and set up Angular Material and theming.
- Generate schematics: These schematics are used to modify projects, add configurations and scripts, and scaffold artifacts in library using
ng generatecommand. For example, @angular/material generation schematic supplies generation schematics for the UI components. Let's say the table component is generated using
ng generate @angular/material:table.
- Update schematics: These schematics are used to update library's dependencies and adjust for breaking changes in a new library release using
ng updatecommand. For example, @angular/material update schematic updates material and cdk dependencies using
ng update @angular/materialcommand.
July 21, 2022