My first schematic
Getting started with Schematics
If you are using VSCode and encounter issues loading schemas, check this article: https://bobbyhadz.com/blog/unable-to-load-schema-from-vscode-cannot-open.
Goals for this section
- 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 @pbuilder/cli
or usenpx @pbuilder/cli
.
Create a schematic project
Execute:
You can see all the command option if you execute:
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:
2. We are ready to test our first schematic, run:
6. To test it we can run:
Congratulations! 🚀 You’ve successfully run your first schematic!