I'd like to compose the ngpackagr schematic with my own. Inside my custom rule I do something like:
export function testScehma(_options: any): Rule {
return chain([
externalSchematic('@angular-devkit/build-ng-packagr', 'build', _options),
(tree: Tree, _context: SchematicContext) => {
tree.create('testFile.txt', 'This is a Test!!!');
return tree;
}
]);
}
Then I try to run: ng my-test-lib build
.
I get the following error:
Error: Package "@angular-devkit/build-ng-packagr" was found but does not support schematics.
Where do I find the ngpackagr
schematics to be able to extend it?
Schematics is used to manipulate files.
I don't think the build mechanism is built by schematic, but more with Webpack (and in the future - Bazel).
That's why I believe it says that @angular-devkit/build-ng-packagr
does not support schematics.
So I think that if you want to test it, try something like -
externalSchematic('@schematics/angular', 'component', options)
To experiment with how you can create custom components for example.
If you want to customize the build, I think that for now (unless I'm mistaken) you are bound to the configuration options that exist in the angular.json
file.