Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

externalSchematic executes schematics from migration.json instead of collection.json

オープン
#21,131 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
angular, typescript
領域
tooling

調査の方向性

SchematicEngine.createCollection と、レポートで説明されている externalSchematic の呼び出しから始め、同じパッケージ名で collection.json と migration.json がどのように読み込まれ、キャッシュされるかを追跡します。ngx-my-lib のシナリオを再現し、externalSchematic が migration.json ではなく collection.json から schematic を解決することを確認します。

索引モデルが issue の本文から書いたものです。

説明

area: @angular-devkit/schematics freq1: low severity3: broken type: bug/fix

🐞 Bug report

Command
  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc
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

  1. The package ngx-my-lib has the schematic config defined in the collection.json
  2. Create a migration schematic for the package ngx-my-lib.
  3. Call the externalSchematic function with externalSchematic('ngx-my-lib', 'config') in the migration schematic.
  4. 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.

主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
16時間 35分
マージ済み PR(30日)
176

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

angular/angular-cli のほかの issue

angular/angular-cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。