jslicense / licensee.js

check dependency licenses against rules
https://www.npmjs.com/package/licensee
Apache License 2.0
185 stars 23 forks source link

- Enhancement: Add config to be able to disable `npm ls` error aborting #68

Closed brettz9 closed 4 years ago

brettz9 commented 4 years ago

Hi,

Have been enjoying using licensee.js within my license-badger program.

I ran into an issue just now though in that I get an exit code from the process which runs npm ls. I happen to know that the error can be safely ignored (a stated peer dependency is missing, but I know its absence to be safe), so I'd like to proceed (and if I skip the aborting, it goes on to check the licenses well as needed).

So this PR offers to disable such error exit codes from causing an abort. (I didn't re-indent the commands, as I figured there could be some desire to change the option name, assuming there was openness to adding the option.)

ronkorving commented 4 years ago

This is definitely a much longer route to take, but would it not make more sense to make a feature request over at npm? Either to not complain about missing peer deps, or to be able to filter them out. npm ls takes plenty of options already.

Alternatively, use https://github.com/npm/npm-remote-ls to do the ls and throw in your own logic, instead of spawning npm.

brettz9 commented 4 years ago

When the npm community forums were active, I submitted a number of suggestions and don't think I received much of any replies, from what I recall.

The programmatic approach sounds like a good one to me. If that doesn't provide the specific error, I realized I probably should have checked stderr here for the specific problem, maybe even recovering without the need to add an option?

ljharb commented 4 years ago

@brettz9 things are different now; file an RFC and it will receive attention.

brettz9 commented 4 years ago

The need for this PR was avoided by commit 20a96638d50140a9d60412c959da32738b593e6a by @amonks , so closing. Nice!