Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As a CLI user, I want ng update to also update dependencies IF they're present. #13015

Closed
hansl opened this issue Nov 20, 2018 · 3 comments · Fixed by #13124
Closed

As a CLI user, I want ng update to also update dependencies IF they're present. #13015

hansl opened this issue Nov 20, 2018 · 3 comments · Fixed by #13124
Labels
feature Issue that requests a new feature
Milestone

Comments

@hansl
Copy link
Contributor

hansl commented Nov 20, 2018

This requires a field similar to peerDependencies, but those are required by Node, so only looked at by the update schematics. So something like optionalPeerDependencies that is read by ng update, and if the dependency is there treat it as a peer deps, otherwise ignore the field.

This is useful because we want ng update @angular/cli to update build-angular and other packages automatically, but still let the user remove them from their projects if they’re not needed (so not directly depend on them). Same for angular.

Solution A: add a new dependencies to the ng-update field in package.json. This has similar semantics to dependencies in the root package.json object, but would be only used by ng update itself.

Solution B (recommended): Considering we already support packageGroup, I suggest reusing it instead. Right now, the packageGroup field in the ng-update field in the package.json is typed string[] and does not support setting different versions of it. Reusing that field to type it string[] | { [name: string]: string } where the value is a version range (similar to dependencies) would fix this the right way, while keeping backward compatibility AND keeping the change scoped to ng-update itself.

The second solution would take less than a day to build, test and release.

Please discuss.

hansl added a commit to hansl/angular-cli that referenced this issue Nov 21, 2018
@alan-agius4 alan-agius4 added feature Issue that requests a new feature comp: schematics/update labels Nov 21, 2018
@ngbot ngbot bot added this to the Backlog milestone Nov 21, 2018
@filipesilva
Copy link
Contributor

I like the solution B myself.

The relationship between @angular-devkit/build-angular is not a dependency or a peer dependency proper, but more akin to the (unexistent npm/npm#3066) optionalPeerDepencencies. Or maybe some optional co-dependency?

So it means @angular-devkit/build-angular doesn't depend on @angular/cli but if it's there, it should be this version range, and vice-versa.

@alan-agius4
Copy link
Collaborator

Solution B seems somewhat neater and indeed some packages are not a direct dependency.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Issue that requests a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants