buildNpmPackage: add support for npm-shrinkwrap.json#443832
buildNpmPackage: add support for npm-shrinkwrap.json#443832doronbehar merged 1 commit intoNixOS:stagingfrom
npm-shrinkwrap.json#443832Conversation
sarahec
left a comment
There was a problem hiding this comment.
Move this to staging, please (the threshold is 5000+ rebuilds). See https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#rebasing-between-branches-ie-from-master-to-staging
e322274 to
8463f6b
Compare
raboof
left a comment
There was a problem hiding this comment.
I don't feel qualified to judge whether this change makes sense globally for npm-config-hook.sh, but I can confirm that it seems to work for x2t.
|
@winterqt I'll defer to your judgement. |
|
In case someone needs convincing, you can confirm using the following script that npm does not read the rm -rf repro
(
set -e
mkdir repro
cd repro
echo '{}' > package.json
echo 'invalid json' > package-lock.json
! npm ci
echo '{}' > npm-shrinkwrap.json
npm ci
echo
echo "=========="
echo
for file in *; do
echo "=== Contents of $file ==="
cat "$file"
echo
done
)
rm -rf reproThere is also this test case in npm repo: https://github.com/npm/cli/blob/d3896147c61b06d6d39a55bbb609f878548e0107/workspaces/arborist/test/shrinkwrap.js#L1612-L1620 |
doronbehar
left a comment
There was a problem hiding this comment.
This approach would feel a bit safer to reviewers, and I won't mind merge it and be responsible for it.
ce6fe1a to
3ef36b4
Compare
|
I'm not sure this made sense as a global change. From what I can see, this broke most packages it touched because Hydra already caught one instance of this issue: https://hydra.nixos.org/build/312774851/nixlog/5 And I'm also not sure it's great that we now have to sync the (fairly rare) I see at least two possible courses of action here to fix the breakages:
I don't know enough about the npm ecosystem in nixpkgs to take care of all of 2., so I'd like to hear your opinion on this first. :) Relevant to ZHF: #457852 |
|
I've opened #460084 to address this. |
|
Damn I'm surprised we missed it, and that more then a month later we got notified this is buggy. |
|
|
||
| postPatch = '' | ||
| ln -s npm-shrinkwrap.json package-lock.json |
There was a problem hiding this comment.
If this PR was completely buggy, I wonder how come balena-cli hasn't became broken. @thunze Do you have an idea?
There was a problem hiding this comment.
nix-build -A balena-cli.npmDeps --check fails for me.
There was a problem hiding this comment.
Oh I see. We see this failure only now when this PR has reached master.
According to https://docs.npmjs.com/cli/v11/configuring-npm/npm-shrinkwrap-json, it's that file that is used in priority over
package-lock.json.Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.