-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
What do you think of lockfiles? #479
Comments
The purpose of lockfile is to lock the explicit package version and checksum, since package.json doesn't do that (like |
The lockfile defeats the whole purpose of the caret |
Just FYI, Sindre let me know on Twitter that he doesn’t intend to commit the
|
@sonicdoe yeah that's the reason i ask him here. maybe he can explain a bit more here |
@luftywiranda13 I think he don't intent to commit it for the packages, and I think it shouldn't be also. The package should be flexible and shouldn't lock the user from using newer packages it depends on. |
@dangh but i have a specific concern behind this as the reason why post him a question here, but let's just wait for Sindre to answer first then maybe we can discuss it 😄 |
Lockfiles for apps, but not for packages. Lockfiles are great for apps where you want a controlled reproducible environment, but for packages this doesn't make much sense. The |
It's a much needed rewrite with many nice features, but it's currently way too buggy for actual usage: npm/npm#16991 I'm staying on npm v4 for now. |
If you 👎 my comment, please tell me how I'm wrong (with technical arguments). |
Lockfiles are good for apps, not packages. See sindresorhus/ama#479 (comment).
Lockfiles are good for apps, not packages. See sindresorhus/ama#479 (comment).
I just found this article on the yarn blog regarding lockfiles : they explain why (in their opinion) lockfiles should also be committed for libraries. |
I think adding a lockfile for any project is extremely valuable as it reduces the amount of unknowns when debugging issues. More knowledge is more valuable than less in my opinion. Theoretically if someone comes in with a breaking change after installing a package as a dependency you can have them locally install the package (having the lockfile manage the dependencies), symlink to the local with the expected dependencies, and check if the problem still exists. If so, then you've easily narrowed down what the problem could be. Granted there may be a better way to detect if versions being out of sync are the problem, but I still contest that there is value to knowing what depedencies are expected than not. Especially since when a bug is found and debugging needs to happen, there is a number of reasons the package collaborators won't have the same versions of dependencies at the time the bug was caught compared to the time when they released the last version of the package that is potentially introducing the bug. With a lockfile you can at least look at the dependencies at the time that version was released (as opposed to whatever it is you have installed locally). The amount of unknowns grows rapidly with the amount of unique collaborators and their environments. Plus if you also switched development environments regularly (work vs home computer), it is possible (though probably rare) that one environment falls out of sync with another environment when you are not using lockfiles which could potentially introduce a hard to track down bug during package development. More known data makes inevitable failure easier to track down and squash. That's my philosophy. |
As recommended here: sindresorhus/ama#479 (comment)
@sindresorhus I found your argument very compelling, and was opening a pull request to one of the libraries I maintain to |
Lockfiles for apps, but not for packages. sindresorhus/ama#479 (comment)
Lockfiles for apps, but not for packages. sindresorhus/ama#479 (comment)
Seemingly not suitable for packages. sindresorhus/ama#479 (comment)
Lockfiles are good for apps, not packages. See sindresorhus/ama#479 (comment).
@sindresorhus Is this still your opinion in 2024? Because there's two stories here (for one of them your point of view makes sense):
ConsumersNow lets first acknowledge that in story How the consumers package manager behaves is driven by ContributersThis is you, your team mates and anyone that stops by to help out. How will you ensure that time is not wasted on problems easily circumvented by simply pinning the hash of all your packages. |
I would rather know about issues with dependencies that users are having, even if it adds a slight burden on a contributors. As always, it's about trade-offs. I have gone without lockfiles for years, and contributors to my projects rarely have any issues. There have been a few cases of a lining rule changing behavior, but that was an easy fix. What has broken my project many times was changes in Node.js versions and the OS, or differences in the OS setup, which lockfiles would not help with. Lockfiles could actually cause the opposite problem here. A new Node.js version breaks something, a dependency gets fixed in a patch version, and contributors still experience the issue because the lockfile prevents using the new patch version of the dependency. It may be possible to pin Node.js version used in a project too, but you still cannot pin the operating system. |
Hello Sindre!
In the latest npm (version 5), it creates package-lock.json by default. Yes same like yarn for now.
What do you think of it? Should we commit the lockfile to git or is it better to get it ignored?
And also what do you think about the latest npm itself? Does it miss something?
Thanks, great day!
The text was updated successfully, but these errors were encountered: