-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Upgrade transient deps during upgrades. #4636
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
Conversation
This change will increase the build size from 9.92 MB to 9.93 MB, an increase of 8.17 KB (0%)
|
__tests__/commands/upgrade.js
Outdated
@@ -31,6 +31,11 @@ const expectInstalledDevDependency = async (config, name, range, expectedVersion | |||
await _expectDependency('devDependencies', config, name, range, expectedVersion); | |||
}; | |||
|
|||
const expectInstalledTransientDependency = async (config, name, range, expectedVersion) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think transient is not the right word here. It should be transitive. same goes for other usages of transient in the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoopsies 😆 thanks for noticing that.
I'm running this locally and it seems to ignore my .yarnrc file in my project. it Points to an internal registry, but yarn upgrade --verbose logs calls to registry.yarnpkg.com. I'm not sure if it's related to running locally or not, but yarn install did not have the same issue. overall though it looks like it works. Thanks! |
@bdwain is this .yarnrc registry thing a new error in this PR, or did it not work in v1.0 either? I'll try to set something up here to reproduce the error... |
Hmm, OK so yeah I see the same error as @bdwain if I have a With Yarn v1.0:
With this PR:
that's very weird. I have no clue what I would have changed that would have affected that. Well, I'll start digging in... edit: This is broken in edit2: |
I'm not convinced this is the right behavior. Let's say with have:
If I run |
@arcanis hmm, interesting case. Maybe direct dependencies get excluded from that recursion? |
@arcanis I added a test for the case you mentioned. (also fixed merge conflicts and added some verbose logging to the upgrade process) |
Thanks @rally25rs! I just merged #4654 which should ship with fixes to a few commands that include upgrade and upgrade-interactive, do you mind rebasing and checking if it makes your tests pass as well? |
Tried this PR on a larger project of mine and it correctly produced the same |
Thank you both! |
thanks again! |
* [yarnpkg#4476] Upgrade transient deps during upgrades. * Rename 'transient' to 'transitive' * dont upgrade direct deps unless requested, add verbose upgrade logging * upgrade-interactive reuse lockfile cleaning from upgrade.js
@rally25rs if I run the upgrade command with the latest flag (for example yarn upgrade package-name --latest) then the transitive dependencies won’t be upgraded. I think that it is the wrong behavior. What do you think about it? |
Summary
Fixes #4476
Due to the changes made to
upgrade
for v1, we inadvertently stopped upgrading transient dependencies.This happend for 2 reasons:
This change will now clear dependencies to be upgraded, recursively, from the lockfile. This lets transient deps get upgrade as well. In the case that all packages are being upgraded, the lockfile is just removed and rebuilt.
I also found a bug in upgrade in yarn v1.0 and fixed that while in here...
in Yarn v1.0 if you
yarn upgrade some-package
then it will possibly upgradesome-package
if there is a new version, but the transient deps underneathsome-package
would not be upgraded (because of the entries in the lockfile, mentioned above). With this update those transient deps will be upgraded.Test plan
Added 2 additional unit tests that check transient deps.