I am trying to create custom schemas for angular cli. Until now, I realized that the "compilation" must be compiled, cli cannot read typescript. This means that you cannot just clone https://github.com/angular/devkit/tree/master/packages/schematics/angular to change everything you need and publish it to npm, which means you need to clone all https : //github.com/angular/devkit and use it npm run build to create compiled circuits you need to run it through tsc , then you can publish these compiled files to npm and install it globally using npm, for example
npm i -g @thescrollbar/schematics
then I would have to do ng new --collection=@thescrollbar /schematics my-app , but surprisingly enough, it didn’t work and threw tree.branch is not a function .
But if you copy this globally installed package to the cli module
/usr/local/bin/node_modules/@thescrollbar/schematics → /usr/local/bin/node_modules/@angular/cli/node_modules/@thescrollbar/schematics
it starts working and you can create a new application based on your circuits.
Now for a new problem, I have no workaround when I try to generate new components using
ng gc --collection=@thescrollbar /schematics logo
he creates it using the @schematics/angular template instead of my collection, even though when I specifically do
ng g shat --collection=@thescrollbar /schematics logo
it says
The shat schema was not found in the @ thescrollbar / schematics collection.
which, I think, clearly indicates that he really uses my collection?
Who managed to create custom collections? Globally and to create components / modules?
angular angular-cli
foxx
source share