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

Support for custom dependencies folder and support to allow taking into account resolutions #33

Open
knyy opened this issue Apr 25, 2018 · 1 comment

Comments

@knyy
Copy link

knyy commented Apr 25, 2018

Hey Michał , thanks for writing this plugin it has been very useful in the current project I am working on.

I hope you would consider adding support for the following issues;

  1. Is it possible to have support for an option to use a custom node_modules or bower_components folder to check against?

My current use case is that I have two node_modules folder, one for third party public libraries and one for inhouse developed modules which we have packaged as npm modules.

Currently to get that to work I am adding something like this as an override (check-dependencies.js L65):

if (options.customDepsDir) { depsDirName = options.customDepsDir; } else { depsDirName = options.packageManager === 'npm' ? node_modules' : 'bower_components'; }

  1. If package.json or bower.json has resolutions it is not taken into account. Would it be possible to have an option to take into account resolutions?

For example in the following package.json, check dependencies will throw an error that 2.0.0 is installed and 1.0.0 is required:

{ "dependencies" : { "my-node-module" :" 1.0.0" }, "resolutions" : { "my-node-module" : "2.0.0" } }

To get resolutions taken into account I am adding the following lines (check-dependencies.js L195):

const resolutionsMappings = getDepsMappingsFromScopeList(['resolutions']); const fullDepsMappings = Object.assign({}, depsMappings, optionalDepsMappings, resolutionsMappings);

Maybe an option can be added to allow resolutions to override what is set in dependencies version.

I am able to work on these changes and send you a PR for review if you decide to include these features.

Thanks for your time.

@mgol
Copy link
Owner

mgol commented May 2, 2018

Thanks for the report.

How are you handling installing packages in a directory named differently than node_modules and without a separate package.json? I see a potential problem here. Wouldn't it work for you to have an inner directory with its own package.json and node_modules and fire check-dependencies there as well?

P.S. I won't be available for the next few weeks so please don't expect a quick resolution here. Thanks for your understanding!

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

No branches or pull requests

2 participants