fix(@angular/cli): discover migrations and schematics from installed packages when omitted by registry metadata - #33718
Conversation
f2f94fc to
5942e69
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors the ng add command to streamline package installation and cleanup, and introduces a fallback mechanism in the ng update command to resolve migrations from installed package.json files when they are omitted from the update plan. Feedback on the changes highlights an inefficient install-uninstall-reinstall cycle for built-in schematics during cleanup, suggesting that we avoid cleaning up temporary dependencies if they are part of BUILT_IN_SCHEMATICS.
930915a to
a6b9487
Compare
…mitted by registry metadata Private package registries such as GitHub Packages frequently strip out custom non-npm metadata properties (e.g., ng-update or schematics) from their remote API responses. Previously, this caused ng update to skip migration execution during updates from those registries, even though ng update --migrate-only worked correctly. This commit adds a post-installation disk-fallback check in ng update: for any updated packages that were not scheduled for migrations from registry metadata, the CLI inspects node_modules/<package>/package.json on disk after installation. If an ng-update.migrations collection is found, it is automatically added to the migration queue and executed. Closes angular#33717
…nifest on disk for schematics Private package registries such as GitHub Packages frequently strip out custom non-npm metadata properties (such as schematics and ng-add) from their remote API responses. Previously, ng add skipped confirming and installing a package if the registry metadata did not report hasSchematics, causing ng add to fail on first run. This commit removes the early skip condition based on registry metadata so ng add always installs the target package to inspect its physical manifest on disk. If no schematics are found after installation, the CLI cleanly removes the temporary dependency. Closes angular#33060
a6b9487 to
c957ded
Compare
- Add JSDoc to `resolveFallbackMigrations` in `ng update` documenting why the post-installation disk check is needed for fallback migrations (private registries like GitHub Packages stripping custom non-npm metadata). - Avoid cleaning up temporary dependencies during `ng add` if they are part of `BUILT_IN_SCHEMATICS`, preventing an inefficient install-uninstall-reinstall cycle. TAG=agy CONV=b92ba928-67b0-4f4b-a79a-ce19e5098641
853624e to
8f5c175
Compare
… when omitted by registry metadata TAG=agy CONV=b92ba928-67b0-4f4b-a79a-ce19e5098641
8f5c175 to
78a2b68
Compare
…mitted by registry metadata (#33718) Private package registries such as GitHub Packages frequently strip out custom non-npm metadata properties (e.g., ng-update or schematics) from their remote API responses. Previously, this caused ng update to skip migration execution during updates from those registries, even though ng update --migrate-only worked correctly. This commit adds a post-installation disk-fallback check in ng update: for any updated packages that were not scheduled for migrations from registry metadata, the CLI inspects node_modules/<package>/package.json on disk after installation. If an ng-update.migrations collection is found, it is automatically added to the migration queue and executed. Closes #33717 PR Close #33718
…nifest on disk for schematics (#33718) Private package registries such as GitHub Packages frequently strip out custom non-npm metadata properties (such as schematics and ng-add) from their remote API responses. Previously, ng add skipped confirming and installing a package if the registry metadata did not report hasSchematics, causing ng add to fail on first run. This commit removes the early skip condition based on registry metadata so ng add always installs the target package to inspect its physical manifest on disk. If no schematics are found after installation, the CLI cleanly removes the temporary dependency. Closes #33060 PR Close #33718
…nifest on disk for schematics (#33718) Private package registries such as GitHub Packages frequently strip out custom non-npm metadata properties (such as schematics and ng-add) from their remote API responses. Previously, ng add skipped confirming and installing a package if the registry metadata did not report hasSchematics, causing ng add to fail on first run. This commit removes the early skip condition based on registry metadata so ng add always installs the target package to inspect its physical manifest on disk. If no schematics are found after installation, the CLI cleanly removes the temporary dependency. Closes #33060 PR Close #33718
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This PR resolves issues where private package registries (such as GitHub Packages) strip custom non-npm metadata properties (
ng-updateandschematics) from their remote registry API responses.1.
ng update(#33717)ng update(packages/angular/cli/src/commands/update/cli.ts).node_modules/<package>/package.jsonon disk after installation.ng-update.migrationscollection is found, it is automatically queued and executed.ng updatedoes not execute migrations for GitHub Packages packages although--migrate-onlyworks and migration exists in build #337172.
ng add(#33060)skipcondition based on registry metadata song addalways installs the target package to inspect its physical manifest on disk (packages/angular/cli/src/commands/add/cli.ts).