Open ilkecan opened 3 years ago
It seems npm ci
doesn't run hook scripts, so it is not an option to make it replace npm install
before resolving https://github.com/nix-community/npmlock2nix/issues/110.
Actually I just realized even with the proposed changes the interface is not expressive enough for me. Ideally there should be a parameter named installCommands
that defaults to [ "npm install --offline --nodedir=${nodeSource nodejs}" ]
, similar to buildCommands
in npmlock2nix.build
. But the problem is again, one can't reuse the --nodedir=${nodeSource nodejs}"
part if they want to define the parameter themselves.
I just realized npmlock2nix
has internal
attribute, so it is actually possible to reuse nodeSource
function. With this in mind, I think introducing installCommands
is the better solution.
Basically I want to be able to pass the
--ignore-scripts
flag. Normally just parameterizing npm flags would be better but one might want to usenpm ci
instead ofnpm install
. One possibility is to replacenpm install
withnpm ci
, hard code the latter and take the flags with a parameter likenpmFlags
.I also left
--nodedir=${nodeSource nodejs}
hardcoded since it is not possible to pass it otherwise sincenodeSource
is an internal function.