馃悶 Bug report
Command
Is this a regression?
No
Description
The function externalSchematic from @angular-devkit/schematics does not call the schematic from the collection.json but instead from the migration.json If the collection (package) name is the same as the current package that is migrated.
馃敩 Minimal Reproduction
- The package
ngx-my-lib has the schematic config defined in the collection.json
- Create a migration schematic for the package
ngx-my-lib.
- Call the externalSchematic function with
externalSchematic('ngx-my-lib', 'config') in the migration schematic.
- Execute the migration schematic
馃敟 Exception or Error
Schematic "config" not found in collection "ngx-my-lib"
馃實 Your Environment
Angular CLI: 12.0.3
Node: 14.16.1
Package Manager: yarn 1.22.10
OS: linux x64
Angular: undefined
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1200.3
@angular-devkit/core 12.0.3
@angular-devkit/schematics 12.0.3
@angular/cli 12.0.3
@schematics/angular 12.0.3
typescript 4.2.4
Anything else relevant?
I could track down this error to the createCollection method in the class SchematicEngine. Invoking the externalSchematic the Collection instance for the migration.json is cached with the key ngx-my-lib. So the external schematic execution does not load the collection for the collection.json, but for the migration.json.
馃悶 Bug report
Command
Is this a regression?
NoDescription
The function
externalSchematicfrom@angular-devkit/schematicsdoes not call the schematic from thecollection.jsonbut instead from themigration.jsonIf the collection (package) name is the same as the current package that is migrated.馃敩 Minimal Reproduction
ngx-my-libhas the schematicconfigdefined in thecollection.jsonngx-my-lib.externalSchematic('ngx-my-lib', 'config')in the migration schematic.馃敟 Exception or Error
馃實 Your Environment
Anything else relevant?
I could track down this error to the
createCollectionmethod in the classSchematicEngine. Invoking theexternalSchematictheCollectioninstance for themigration.jsonis cached with the keyngx-my-lib. So the external schematic execution does not load the collection for thecollection.json, but for themigration.json.