-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
add package-lock=true to .npmrc #7676
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
Conversation
Signed-off-by: Matteo Collina <hello@matteocollina.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot wasn't able to review any files in this pull request.
Files not reviewed (1)
- .npmrc: Language not supported
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #7676 +/- ##
==========================================
- Coverage 74.63% 74.61% -0.03%
==========================================
Files 96 96
Lines 7689 7689
Branches 192 192
==========================================
- Hits 5739 5737 -2
- Misses 1948 1950 +2
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Can you elaborate why this is needed? What are the consequences of not doing this? |
Per the docs, https://docs.npmjs.com/cli/v11/using-npm/config#package-lock, this is set to true by default -- why do we need to explicitly set it? |
Because quite a few high-profile maintainers (including me) set this to Note it would not be needed if the project could build without that file - currently it doesn't . My guess is some dependencies are not really following semver. |
We should look into that |
Ah, I see, makes sense to me to set it then 👍 Would it be worth adding a comment above the line explaining why we're setting what is a default? |
Co-authored-by: Aviv Keller <me@aviv.sh> Signed-off-by: Matteo Collina <matteo.collina@gmail.com>
I am able to build with a deleted git clean -dfX # Remove all non-tracked files
rm package-lock.json
npm i
npm build |
It's a precaution to avoid breaking production and to ensure everyone has the same development environment. It's a good practice, and that's why deleting the package-lock isn't an option I see as viable |
@@ -1,2 +1,4 @@ | |||
# See bug in peerdeps resolution: https://github.com/npm/cli/issues/2999 | |||
legacy-peer-deps = false | |||
# TODO(@mcollina): Currently, the lockfile is needed to build, so we explicitly require it's use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned in my previous comment, it's a way to prevent breaking production and to ensure we all share the same development environment. So a comment like that can be useful, and it’s worth mentioning that some developers disabled it for a specific reason.
Closing due to #7662 |
pnpm suffers from the same issue, and it's 100% irrelevant to why this is needed. |
Given we no longer have an npmrc file at all, could you not just have your own locally and add it to your local gitignore, if this is something your setup needs still? |
As titled. A user can override this with their global
.npmrc
setting.Note that the project does not build if the deps are not installed from the lockfile.