QuiiBz/sherif

feat: explicitly allow multiple versions

Closed this issue ยท 4 comments

We have different apps on different versions of next and react. We use peer dependencies to ensure that a package can be installed on an app, which works well for us. That means that maybe package-b is using react 18, but doesn't support react 17. so app-a on react 17 can't use package-b yet.

We'd love to allow specific versions of react, or set allow max 2 different versions.

Based on clarity and common conventions, I propose using --allow for specifying allowed versions and --max for specifying the maximum number of versions allowed.

npx sherif --allow react@17.0.2 react@18.0.2 --allow next@14.3.0 next@13.2.4

and

npx sherif --max react 2 --max next 2

To be honest, the second idea I don't really like. I favour the first, "allow", option. Although I just had to spitball the idea of having a "max" flag too.

I quite like --allow, it makes sense to add this feature instead of completely ignoring a dependency (as currently recommended)

I tried to fork the repo and give it a go although I have never written Rust so I didn't get very far ๐Ÿ˜‚

If it ever gets picked up I am happy to help with testing or anything like that!

Same idea but updated a bit to avoid creating a new option by re-using the --ignore-dependency option to also accepts dependency@version: #84

Let me know if that looks good to you!

It looks good, shall we close this one?