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

package-lock.json #1392

Closed
rom1504 opened this issue May 15, 2018 · 6 comments
Closed

package-lock.json #1392

rom1504 opened this issue May 15, 2018 · 6 comments
Labels

Comments

@rom1504
Copy link
Member

@rom1504 rom1504 commented May 15, 2018

Hi,
I just discovered that package-lock.json is not transitive :
https://docs.npmjs.com/files/package-lock.json

One key detail about package-lock.json is that it cannot be published, and it will be ignored if found in any place other than the toplevel package. It shares a format with npm-shrinkwrap.json, which is essentially the same file, but allows publication. This is not recommended unless deploying a CLI tool or otherwise using the publication process for producing production packages.

That was my main critic about package-lock.json : I was afraid to have to update all the libs to get an updated version of dependent lib. But actually this is not the case.

package-lock.json is only used when a package is used directly.

I know you tried package-lock.json for a while @feross and you decided against it.

Did you have any other reason than that problem ?

@KayleePop

This comment has been minimized.

Copy link
Contributor

@KayleePop KayleePop commented May 16, 2018

This is related https://yarnpkg.com/blog/2016/11/24/lockfiles-for-all/

It's about the yarn lockfile, but the same logic applies to the package-lock.json

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented May 16, 2018

The only scenario I find in useful in the context of WebTorrent is if MAYBE we have to reproduce something caused by dependencies. But it has never happened. Rarely anyone runs npm install while webtorrent being the top level, that's mostly us contributing, and we are fine without it.

@rom1504

This comment has been minimized.

Copy link
Member Author

@rom1504 rom1504 commented May 16, 2018

@rom1504

This comment has been minimized.

Copy link
Member Author

@rom1504 rom1504 commented May 16, 2018

@feross feross added the question label May 16, 2018
@feross

This comment has been minimized.

Copy link
Member

@feross feross commented May 16, 2018

Here's my philosophy:

package-lock.json is for top-level apps, not for packages. If you use it inside a package it will only confuse you when you run npm install and get different (locked) dependencies than your users get when they run npm install package-name.

As @DiegoRBaquero says, one possible advantage of package-lock.json for modules is that it documents which set of dependencies we know to work (in case a dependency suddenly causes our tests to start failing). However, I haven't found this useful in practice.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented May 16, 2018

I'm closing this issue since there's no bug to fix here, but feel free to continue discussion!

@feross feross closed this May 16, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Aug 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.