christopherthielen / check-peer-dependencies

Checks peer dependencies of the current NodeJS package. Offers solutions for any that are unmet.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature request] Fail command if peer deps are not met

danielfigueiredo opened this issue · comments

Hi there, thanks for writing this lib! One thing that would be really helpful is to automate this check on CI, to prevent merges with peer dependencies not met.

There are ways obviously to store the output of this lib and parse the file, but it would be awesome to:

  1. Have some error code to identify when they are not met for easy grep. I think right now the only indicator it is not met is the ❌ at the beginning of the line.
  2. Fail the process with exit code 1 so that we know it failed to verify peer deps are met. This could be an optional flag for backwards compatibility, but it would be very helpful!

Thanks!

Maybe exactly the same as is done for yarn-deduplicate with --fail option: https://github.com/scinos/yarn-deduplicate#usage-in-ci. Supporting --fail would be a backwards compatible change as well as nothing would change when that is not supplied.

And while testing this library out actually, I just realized that this is already supported? Call fails with process.exit(1) if there are peer warnings: https://github.com/christopherthielen/check-peer-dependencies/blob/master/src/checkPeerDependencies.ts#L171.

Yes, as @gonadarian noticed, the process already exits with non-zero error code if anything fails, or peer deps are unsatisfied.