pnpm / pnpm

Fast, disk space efficient package manager
https://pnpm.io
MIT License
29.55k stars 1k forks source link

Implement "overrides" that is compatible with npm 8.3 "overrides" #4190

Open Artur- opened 2 years ago

Artur- commented 2 years ago

Describe the user story

As a user of package managers, I want common features of all package managers to be configured in the same way to ease switching between them when necessary. The overrides feature has been for quite some time in pnpm but was made a "standard" feature in npm 8.3: https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides

Describe the solution you'd like

pnpm should support the same syntax and work the same way as npm 8.3 if you defined "overrides" in package.json

Describe the drawbacks of your solution

Not sure if the existing pnpm overrides syntax matches the npm version. It should probably be deprecated for removal in either case.

Describe alternatives you've considered

imsys commented 2 years ago

I also would like this as a standard, and would appreciate this a lot.

imsys commented 2 years ago

This is almost like CSS Vendor Prefixes.

metametadata commented 1 month ago

I was surprised that the official npm overrides feature has no effect when using pnpm. Maybe pnpm could at least print a warning that such key will not be respected.

jayvdb commented 2 weeks ago

Worth noting that pnpm had this feature way before npm. I started to compile a list of package dependencies with this feature at https://github.com/rust-lang/cargo/issues/5640#issuecomment-2392557068

Note there there may be some features of npm overrides that appear to be missing from pnpm.overrides , such as replacing a package with a package with a different name (I havent tested this works).

https://stackoverflow.com/questions/73549082/override-npm-package-with-another-package-entirely https://github.com/npm/cli/issues/4909#issuecomment-1234445809

pnpm.overrides has features that npm doesnt, such as - to remove a dependency.