nathanhleung / install-peerdeps

šŸ’» A command-line interface to install an NPM package and its peer dependencies automatically.
https://www.npmjs.com/package/install-peerdeps
MIT License
296 stars 20 forks source link

Feature Request: Add ability to ignore some peerDependencies #206

Open roykathurima opened 2 years ago

roykathurima commented 2 years ago

Context

We are writing a eslint config that can be used to lint react and non-react projects (also ts and non-ts apps). I know we could write and publish them as different packages each with its own package.json and publish them individually to npm. However, we have one package with all the config separated into different files, each with a specific purpose i.e., only lints JS or TS or react.

Challenge

The challenge comes when installing the peerdeps; if we only want to use the TS-specific config, we do not need to pull react-specific stuff. So we need a way to omit these deps while installing the package.

Possible approach

Allow removing deps with certain keywords, i.e., a user can run npx install-peerdeps --omit-with-keywords="react, typescript" PACKAGE_NAME. The keywords can be a list of comma-separated values.

roykathurima commented 2 years ago

I have opened a PR for this here: https://github.com/nathanhleung/install-peerdeps/pull/207

ljharb commented 2 years ago

This shouldnā€™t be supported. Two packages is a much much better way to manage this - itā€™s why the Airbnb config has two packages.

roykathurima commented 2 years ago

Yeah, we were tryna avoid publishing multiple packages. coz we'll potentially have 3 packages; one for JS, one that extends Js to provide TS support and finally one that extends the TS one to provide react support. If we make changes and bump the base package then we'll need to bump the base-package versions on the other two packages. Plus the packages are really small since they are just extending airbnb config and then overriding a few rules, just felt like an overkill separating them out just because there are some peer deps we do not need.

I know this' a real edge case šŸ˜… and I guess we can figure out something in house. šŸ˜„ Anyway, thanks for the comment and feel free to close this issue and its associated PR :D

ljharb commented 2 years ago

The proper granularity here is definitely ā€œpackageā€. Yes, i understand via maintaining the Airbnb config that this can be annoying, but itā€™s far better than the alternative.