admin管理员组文章数量:1387360
I'm developing an Nx plugin where I want to extend the built-in Angular library generator. My goal is to merge the original Angular library generator schema with my own custom options so that when the generator runs, the CLI prompts for both the original options and my additional ones.
Here's my current setup:
generators.json:
{
"generators": {
"init": {
"factory": "./dist/generators/init/init",
"schema": "./dist/generators/init/schema.json",
"description": "init generator"
}
}
}
schema.json:
{
"$schema": ";,
"$id": "Domain",
"title": "",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "",
"$default": {
"$source": "argv",
"index": 0
},
"x-prompt": "What name would you like to use?"
}
},
"required": ["name"]
}
I attempted to merge my schema with the original Angular library generator’s schema using JSON Schema composition with allOf
:
{
"allOf": [
{
"$ref": "./node_modules/@nrwl/angular/generators/library/schema.json"
},
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Your custom name",
"$default": {
"$source": "argv",
"index": 0
},
"x-prompt": "What name would you like to use?"
},
"customOption": {
"type": "string",
"description": "A custom option for your extended generator",
"x-prompt": "Provide your custom option"
}
},
"required": ["name", "customOption"]
}
]
}
However, when I run my generator, I’m not seeing the prompts for the original Angular library generator options—only my custom options show up.
My Question:
How can I correctly merge the original schema with my custom schema so that the generator prompts include both sets of options? Is there a different approach for extending an existing Nx generator’s schema?
Any suggestions or workarounds would be greatly appreciated!
本文标签:
版权声明:本文标题:nrwl nx - How do I merge custom options with the Angular library generator schema in an Nx custom generator? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744503129a2609434.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论