Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing integrity and resolved fields to package-lock.json. #111

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

plietar
Copy link
Member

@plietar plietar commented Aug 23, 2024

When building Packit with Nix (and other sandboxed build systems), these fields are used to prefetch the dependencies. For some reason they are missing from our file for all but one dependency. There seems to be some npm bug that causes these fields to be removed under certain conditions (npm/cli#4263, npm/cli#6301).

Deleting the lockfile and running npm install again produces a new file that has the missing fields. However in doing so all the dependencies are updated, which I'd rather not right now. Instead I used the script at https://github.com/jeslie0/npm-lockfile to add the fields without changing the version numbers.

When building Packit with Nix (and other sandboxed build systems), these
fields are used to prefetch the dependencies. For some reason they are
missing from our file for all but one dependency. There seems to be some
npm bug that causes these fields to be removed under certain conditions
(npm/cli#4263, npm/cli#6301).

Deleting the lockfile and running `npm install` again produces a new
file that has the missing fields. However in doing so all the
dependencies are updated, which I'd rather not right now. Instead I used
the script at https://github.com/jeslie0/npm-lockfile to add the fields
without changing the version numbers.
@plietar plietar requested a review from M-Kusumgar August 23, 2024 13:00
Copy link

codecov bot commented Aug 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.00%. Comparing base (5cb2e9c) to head (e789eea).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #111   +/-   ##
=======================================
  Coverage   96.00%   96.00%           
=======================================
  Files         106      106           
  Lines         976      976           
  Branches      253      253           
=======================================
  Hits          937      937           
  Misses         38       38           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@M-Kusumgar M-Kusumgar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick question because i am a little bit confused, this does seem like a one time fix (or am i misunderstanding?) this seems like if we install another dep or something it can get into this state again where it has some missing fields? do we meed to run this script more regularly? Set up some sort of automatic CI when it detects these missing fields?

@plietar
Copy link
Member Author

plietar commented Aug 23, 2024

Yes this should be a one time fix. npm normally adds these automatically. If I add something to package.json and npm install the field for that package gets added.
The fact that they got removed the last time this file was touched is a niche npm bug (linked above), and hopefully won’t happen too often. I’m not sure I really understand what causes the bug, but if it ever becomes a problem again we can add a check in CI.

@plietar plietar merged commit 7f89cfc into main Aug 27, 2024
5 checks passed
@plietar plietar deleted the fix-package-json branch August 27, 2024 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants