node2nix icon indicating copy to clipboard operation
node2nix copied to clipboard

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

Open AumyF opened this issue 4 years ago • 1 comments

Fixes #253.

  • peerDependencies are not included by default
  • setting --include-peer-dependencies makes node2nix works as previous default

AumyF avatar Aug 11 '21 18:08 AumyF

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

svanderburg avatar Oct 20 '21 08:10 svanderburg