-
Notifications
You must be signed in to change notification settings - Fork 20
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
install-peerdeps overwrites existing module with an older version #43
Comments
Thanks for the issue - this seems like a valid use case and I've started looking into it. |
Thanks so much for your help. Let me know if there's anyway I can assist. |
Any progress on this issue? Is there anyway I can help? I'd like to update the peer dependencies for my library data-forge-indicators, although then you'll lose my test case. Will that be a problem or do you want me to hold out from updating it a bit longer? |
Hi, thanks for reaching out again. I haven't been able to work on it recently - if you could submit a pull I'll gladly accept it. One potential solution could be reading the Other thoughts:
|
I've started having a look into this problem. I've written a test (added to cli.test.js) that replicates the problem, and @nathanhleung I'd like your thoughts on it:
Some problems:
Once I've figured out the correct way to structure this test it shouldn't be too hard too actually implement code to pass the test (I think writing the test is probably more difficult than the code for the actual feature). |
Hi @ashleydavis and thanks for the test!
Appreciate your work so far and hope my comments are clear. Let me know if you've got any questions! |
…r dep when a more recent version is already installed.
@nathanhleung I've committed the new test and code to make it pass. Unfortunately I've broken several other tests and I'm having a hard time figuring out why! Do you mind having a look and maybe pointing me in the right direction? Thanks! |
Thank you for your contributions so far, and apologies for the late reply! I've created a pull request with your latest changes so they could run on Travis. It looks the tests that add the Also, I'm not sure if you can add commits to #46 yourself since I created it. If that's the case, feel free to open a new pull request and I'll close the one I created. Thanks again for your help! |
Hey, I think I'm going to park this for now. It's turned out to be a bigger job than I expected. I realised today that it's actually much simpler for me replicate the small portion of install-peerdeps taht that I need into my own project than it is to try and get my contribution to install-peerdeps working properly. Thanks again for this library, sorry that I don't have more time to contribute to it right at the moment. Maybe I'll come back to it again the future. |
No worries, thank you for your help so far and I'll keep this open in case you want to come back to it! |
Hi thanks for this package, it's really useful.
I've noticed a (probably obscure) problem with it and just wondering if you have any advice on how to work around it.
First, some background. I'm working on a product called Data-Forge Notebook and it automatically installs npm modules that it finds used in scripts. I found it annoying that npm didn't automatically install peer dependencies. So that lead me to your package.
Here's an example of how I use it. A user of my product includes
request-promise
as follows:const request = require('request-promise');
When a user runs this script in Data-Forge Notebook the module is automatically installed for them. This module also has a peer dependency on the
request
module. I'm made use ofinstall-peerdeps
within Data-Forge Notebook to automatically install peer dependencies like this. What it does in this case is runnpm install request-promise
and then it runsinstall-peerdeps request-promise --only-peers --silent
. This works really well in this case and it ensures that my users automatically have the npm modules they need and also the peer dependencies.However I discovered a problem with a more complicated use case.
You can easily try this example for yourself to see the result.
Create a new directory and package file:
Now install Data-Forge:
npm install --save data-forge
This installs the latest version of Data-Forge which is currently 1.3.0.
Now install the Data-Forge add on library
data-forge-indicators
.npm install --save data-forge-indicators
data-forge-indicators has a peer dependency of data-forge.
Now run your tool as follows:
This actually replaces data-forge 1.3.0 with the older version 1.0.10.
data-forge-indicators has a peer dependency on data-forge at or above that version, yet install-peerdeps replaces the existing version with the older version.
I'm thinking that install-peerdeps should be a bit smarter and realise that there is already a new version installed and that it doesn't need to actually do any work.
What do you think? Is this the way install-peerdeps is supposed to work or is this a bug or maybe a use case that hasn't been thought of?
Thanks for your package and your help.
The text was updated successfully, but these errors were encountered: