externalSchematic executes schematics from migration.json instead of collection.json
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- angular, typescript
- Domain
- tooling
Research direction
Start with SchematicEngine.createCollection and the externalSchematic call described in the report, then trace how collection.json and migration.json are loaded and cached under the same package name. Reproduce the ngx-my-lib scenario and verify that externalSchematic resolves the schematic from collection.json rather than migration.json.
Written by the indexing model from the issue text.
Description
🐞 Bug report
Command
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Is this a regression?
NoDescription
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-libhas the schematicconfigdefined in thecollection.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.
- Dominant language
- TypeScript
- Stars
- 27k
- Forks
- 11.8k
- Avg merge
- 16h 35m
- Merged PRs (30d)
- 176
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from angular/angular-cli
-
area: @angular/build gemini-triaged
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
angular/angular-cli#33055 · 1 comment · 3 reactions ·
-
area: @angular/build gemini-triaged
Difficulty 4/5 3-5 days Newbie friendliness 72/100
angular/angular-cli#34137 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 assignee ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 assignee ·
All issues in angular/angular-cli
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dennys-bd/agent-hive#184 ·
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
ai-observability bug team/ai-observability
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vicharanashala/fln#563 ·