我有几个组件,我写了一些安装这些组件的示意图。为了可维护性,我的原理图在一个单独的包中。
将我的原理图从 Angular6 合并到 Angular7 后,找不到我的原理图。
所以在我的组件的“package.json”中:
{
"name": "@my-project/my-component",
"version": "4.0.0",
"dependencies": {
"@my-project/schematics": "^2.0.0",
"tslib": "^1.9.0"
},
"peerDependencies": {
"@angular/common": "^7.0.0",
"@angular/core": "^7.0.0"
},
"schematics": "./schematics/collection.json",
}
在“./schematics/collection.json”中:
{
"$schema": "./node_modules/@angular-devkit/schematics/collection-schema.json",
"schematics": {
"ng-add": {
"extends" : "@my-project/schematics:my-component-install"
}
}
}
@my-project/schemics 的“collections.json”:
{
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
"schematics": {
"my-component-install": {
"description": "Schematics for installation of @my-project/my-component",
"schema": "./my-component/install/schema.json",
"factory": "./my-component/install/index"
}
}
}
因此,当执行“ng add @my-project/my-component”时,我收到消息:“在集合“@my-project/my-comonent”中找不到示意图“my-component-install”。然而,在 Angular6 中这行得通。
谁能告诉我如何解决这个问题?