Create Schematic using Schematic-CLI from angular-devkit

We can easily create a new schematic which we can use with the help of Angular-CLI in few minutes. Install the required package globally using npm as shown below. You will need node version >= 6.9 for this.

Now create a blank schematics project and switch to that directory.

Navigate to new-component/index.ts and add the following code.


Build & Publish

Navigate to the root of your project and use the following commands.

Link & Install

You can do an npm link to link the schematics project locally to a new angular application created by angular-cli or you can use npm install to add it to your project from remote.


To learn how to use the schematics-cli tool, you can refer to the help command as follows.