-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Yarn incorrectly upgrades all when a package is specified. #5043
Comments
I don't think I'm pretty sure this is a duplicate of #2600 |
I believe that -D is a synonym for --dev. If it is an invalid option, the correct behaviour from Yarn would be to print an error message and not proceed to carry out an operation. However, when -D is placed first, the command behaves as expected and updates the package to the latest version and updates the package.json file with the new 'DevDependency'. Be that as it may '--dev' is definitely a valid option as per the documentation and if I substitute '--dev' for '-D' in the bug described above, the behaviour is exactly the same. So, I don't think its a duplicate of #2600 |
|
Quick followup; I'm not saying that this isn't a bug. The issue is that commander.js literally doesn't pass the package name to Yarn. Quick pain NodeJS example:
If you run Now if you don't have a
If you run Yarn is being run with no package name (due to commander.js losing that argument) and so all packages are upgraded. Fixing issue 2600 would resolve this issue. Sorry if my quickly closing this issue made it come across as dismissive, I certainly didn't mean for it to be. |
Ah - gotcha. It didn't come across as dismissive, just thought you misunderstood my report. What added to my initial assumption was that when I issue the command
for a package that is only in devDependencies, I get a warning:-
This is what led me to believe that I needed to use the '--dev' option on the upgrade command. Should one just ignore that warning? BTW I can now see why it is essentially a duplicate. |
Ah! Now that is possibly a bug. I think @kaylieEB might have been working on something similar? |
Using 1.3.2
Do you want to request a feature or report a bug?
Report a bug.
What is the current behavior?
Yarn incorrectly upgrades all when a package is specified, depending on CLI options.
yarn upgrade --latest -D
results in
If the current behavior is a bug, please provide the steps to reproduce.
results in all packages in package.json being upgraded to latest.
What is the expected behavior?
Only the specified package should be upgraded.
Interestingly, reversing the options leads to the expected behaviour
works as expected
Please mention your node.js, yarn and operating system version.
macOS High Sierra 10.13.1
node 8.9.1
yarn 1.3.2
While there is a workaround (reversing options), it is a quite pernicious bug because undoing the changes made can require quite a bit of work. While backwards compatibility would suggest that one wouldn't change behaviour, it is probably not a good idea to have 'Upgrade All' as the default behaviour when no package name is specified. It would probably be better to require a specific request for All e.g. a '--all' option.
The text was updated successfully, but these errors were encountered: