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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with upgrade-interactive and root dependencies #7671

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JureSotosek
Copy link

@JureSotosek JureSotosek commented Nov 5, 2019

Summary

First of all, I would like to say I love this project 馃挭馃徏
Here is my little contribution, hope you consider it 馃帀

So I encountered the following problem with the upgrade-interactive --latest command.

If you are using workspaces, and you have some root dependencies and some package specific dependencies. If you run upgrade-interactive --latest in one of the package folders, you will be given a choice to upgrade dependencies not only in the current package but also all other packages and the root workspace. If you decide to upgrade a dependency from the root of the workspace, the command won't upgrade the version of the dependency in the root package.json but will leave that one the same, and add that dependency to the current package folder with the new version.

So for example, in the following project: https://github.com/juresotosek/upgrade-interactive-example, if you navigate to the packages/test folder and run upgrade-interactive --latest, and then decide to upgrade typescript, there will be a new devDependency added to the packages/test/package.json and the version of typescript in root package.json won't be changed.

Solution

It turns out that upgrade-interactive --latest looks at the location of the dependency in the workspace, and runs that Add command there. Well, if the dependency is in the root, the location will be en empty string, in that case, it should default to the root of the project while now, it defaults to the current location of where the command was executed. That's what I've changed.

Test plan

Clone the above repo see the behavior.

@JureSotosek
Copy link
Author

Not sure what change I should make to the CHANGELOG, would love some guidance on that 馃憤馃徏

@JureSotosek
Copy link
Author

Did anyone get a chance to check this out?

Not sure who to ping, @arcanis maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant