Coder Social home page Coder Social logo

Comments (3)

G-Rath avatar G-Rath commented on July 24, 2024 1

Personally I'm a fan of having the package-lock.json since it lets you install quickly using npm ci, and lets you audit the package.

It shouldn't result in anyone downloading any extra packages afaik?

from audit-ci.

G-Rath avatar G-Rath commented on July 24, 2024 1

That's true, but only for people checking out this repo, not when using the published package.

If other transitive dependencies have 3.0.1 in their package-lock.json

npm never uses the package-lock.json when installing into node_modules - it implicitly excludes the file when packing (even if you try to explicitly include it), and if you publish a package with it by say packing manually, npm will just ignore it at install time 🙂

In the situation you describe, both npm & yarn should remove the 3.0.0 package in favor of 3.0.1 if it satisfies the constraints of both consuming packages.

(This is the main area where npm & yarn differ in their locks: npm strives for the most accurate tree possible, whereas yarn aims for the most deduplicated, so in these situations yarn can result in slightly few packages as it'll choose to downgrade/not-upgrade instead of have two packages installed when adding a package to an existing tree)

from audit-ci.

quinnturner avatar quinnturner commented on July 24, 2024

Thank you for your input!

It could result in someone downloading extra versions of the same package. If in audit-ci's package.json there's a package with ^3.0.0 but has the package's version set to 3.0.0 in package-lock.json, then it will always download 3.0.0. If other transitive dependencies have 3.0.1 in their package-lock.json then yarn/npm will install both 3.0.0 and 3.0.1, which is probably unnecessary.

I am still leaning towards keeping the package-lock.json for the reasons you mentioned, but am still open to more discussion :)

from audit-ci.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.