Starting my first schematic
Welcome to the schematics world
Goals for this tutorial
Create our first Schematics project.
Set up basic configurations to use our first schematic.
Create our first schematic.
Prerequisites
NodeJS 20+.
Install
npm i -g @builder/cli
or usenpx @pbuilder/cli
.
Create a schematic project
Execute:
builder new <library-name> [author]
Note
builder new --help
Builder-add schematic
The CLI already create a schematics called: builder-add
. After you publish your package and the any user execute: builder add [your-package-name]
, the library will be installed and then builder-add
schematic will be called.
Create the first schematic
1. To create a schematic, execute this:
builder exec @pbuilder/sm sc --name="my-schematic"
2. We are ready to test our first schematic, run:
npm run build
3. To test it we can run:
schematics ./dist/collection.json:my-schematic
Congratulations! 🚀 You’ve successfully run your first schematic!
Please check the fully schematic documentation: https://schematics.pbuilder.dev/