svanderburg / node2nix

Generate Nix expressions to build NPM packages
MIT License
527 stars 100 forks source link

Fix #253: exclude peerDependencies by default even using '--lock' flag #254

Open AumyF opened 3 years ago

AumyF commented 3 years ago

Fixes #253.

svanderburg commented 3 years ago

I need a bit of clarification why this change is needed.

So originally the --include-peer-dependencies option was introduced to tune node2nix's own implementation of the dependency resolution algorithm (so for projects that have a package.json file but no lock file).

The way node2nix handles peer dependencies has changed in several versions. So originally, they were also included as regular dependencies, several versions later they only became a check, and in later revisions they were installed again.

As far as I can see, your change is lock file related -- if I'm not mistaken it should only install peer dependencies in lock files when the --include-peer-dependencies setting is enabled and if not, ignore them.

Is this is behaviour also consistent with what NPM does? And is this also fixing a specific problem?

So far this feature was only developed for the dependency resolution algorithm. Under normal circumstances, you should not directly use this option, but rather a flag that automatically propagates the right settings for a specific Node.js version, e.g. --nodejs-14