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 .npmrc with package-lock=false to disable package-lock.json generation #352

Merged
merged 1 commit into from Jun 9, 2022

Conversation

Uzlopak
Copy link
Contributor

@Uzlopak Uzlopak commented Jun 8, 2022

Checklist

@@ -0,0 +1 @@
package-lock=false
Copy link
Member

Choose a reason for hiding this comment

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

Why it is needed? and what does it solve?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When i run npm i, it creates a package-lock.json, which is fair to say ignored by .gitignore. But still this is the way to disable package-lock.json generation

Copy link
Member

Choose a reason for hiding this comment

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

I means why it need to disable the lock file generation.
If it is something specific to your environment or personal perference, then it shouldn't be checked in git repository.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

That's not a reason.
Here is the PR adding .npmrc with other files in fastify.
fastify/fastify#2269

But, it didn't explain why disable the package-lock.json improve DX.
We can use npm udpate if we install the dependency once.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

npm update does not depend on the lockfile.

@jsumners Any argument why disabling the unnecessary generation of the package-lock.json is a good idea?

Copy link
Member

Choose a reason for hiding this comment

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

Disable package-lock.json means every run for npm install should fetch and install the latest.
Which means after the first npm install, it is actually doing the same thing as npm update.

Copy link
Member

Choose a reason for hiding this comment

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

There is not point to having a package lock in a library project. They are ignored when installing the module as a dependency. The only thing having a package lock in this project will accomplish is to lock versions across contributors to the time when the various contributors start their work on the project.

@mcollina mcollina merged commit d589d0a into fastify:master Jun 9, 2022
@Uzlopak Uzlopak deleted the add-npmrc-package-lock-false branch June 9, 2022 23:08
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.

None yet

4 participants