fix(@angular/cli): fallback to local package.json for schematic detection on first run#33285
Draft
clydin wants to merge 1 commit into
Draft
fix(@angular/cli): fallback to local package.json for schematic detection on first run#33285clydin wants to merge 1 commit into
clydin wants to merge 1 commit into
Conversation
…tion on first run Private package registries frequently strip out custom non-npm metadata properties such as "schematics" or "ng-add" from their remote API responses. This causes `ng add` to bypass executing schematics on the first run. This fix adds a fallback check immediately after package installation: if the registry did not report `hasSchematics` as `true`, the CLI falls back to resolving and reading the physically installed package's `package.json` on disk as the single source of truth. Additionally, if the local manifest specifies `ng-add.save: false` (but it was persistently installed due to registry omissions), it programmatically prunes the package from `dependencies` or `devDependencies` post-execution, and executes a silent `packageManager.install()` to cleanly remove the physical package files and update the lockfile. Fixes angular#33060
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Private package registries frequently strip out custom non-npm metadata properties such as "schematics" or "ng-add" from their remote API responses. This causes
ng addto bypass executing schematics on the first run.This fix adds a fallback check immediately after package installation: if the registry did not report
hasSchematicsastrue, the CLI falls back to resolving and reading the physically installed package'spackage.jsonon disk as the single source of truth.Additionally, if the local manifest specifies
ng-add.save: false(but it was persistently installed due to registry omissions), it programmatically prunes the package fromdependenciesordevDependenciespost-execution, and executes a silentpackageManager.install()to cleanly remove the physical package files and update the lockfile.Fixes #33060