This is Part 3 of a 6-part series on Angular Schematics.


🤖 A note on this article: I used Claude to help reformat and structure the content to make it clearer and more presentable for publication.


References


In Part 2 we built a custom ng generate schematic that scaffolds a component with your organisation's selector prefix. We understand the workspace setup, collection.json, schema.json, factory functions, and file templates.

Part 3 is about a different problem entirely. Not generating code inside a project that already has your library - but automating what happens the very first time a developer installs it.

When a developer runs:

ng add @acme/ui

They should not have to read a 12-step setup guide. The library should configure itself - install its peer dependencies, update angular.json, add any required styles, and leave the workspace in a working state. That is what an ng add schematic does.

By the end of this article you will have built a complete ng add schematic that handles the full installation lifecycle of a library.


Table of Contents

  1. What Happens When You Run ng add
  2. How ng add Differs from ng generate
  3. Registering the ng-add Entry Point