[英]Composing build schematics in angular
I'd like to compose the ngpackagr schematic with my own. 我想用自己的东西来组成ngpackagr原理图。 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
. 然后,我尝试运行:
ng my-test-lib build
。
I get the following error: Error: Package "@angular-devkit/build-ng-packagr" was found but does not support schematics.
我收到以下错误:
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? 我在哪里可以找到
ngpackagr
原理图以进行扩展?
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). 我认为构建机制不是通过原理图构建的,而是通过Webpack(以及将来的Bazel)构建的。
That's why I believe it says that @angular-devkit/build-ng-packagr
does not support schematics. 这就是为什么我相信它说
@angular-devkit/build-ng-packagr
不支持原理图的原因。
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. 如果您想自定义构建,我认为目前(除非我弄错了),您已经绑定到
angular.json
文件中存在的配置选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.