Git Product home page Git Product logo

Comments (3)

crutch12 avatar crutch12 commented on August 17, 2024 1

temporarily published own package without npm-shinkwrap.json file: https://www.npmjs.com/package/@web-bee-ru/branch-name-lint

from branch-name-lint.

yoavain-sundaysky avatar yoavain-sundaysky commented on August 17, 2024

I don't think the idea of having an npm-shrinkwrap.json file is wrong.
When you publish a package whose purpose is to run as a tool, you want to make sure that all runtime dependencies (and their dependencies) are those you tested with. You cannot control transitive dependencies without this npm-shrinkwrap.json.
The problem is this file contains both runtime and dev dependencies.

I had to deal with a similar issue in my project, and the solution was this:

  • Commit the package-lock.json file and not the npm-shrinkwrap.json
  • In your pipeline, after you run tests and build the project and before you pack your package, run a script that:
    1. Removes dev dependencies
    2. Deletes package-lock.json file*
    3. Creates npm-shrinkwrap.json file

Something like this:

npm prune --production && del package-lock.json && npm shrinkwrap

* The reason to delete the package-lock.json file is that npm prune --production only deletes files from the node_modules folder and does not update the package-lock.json file, and the npm shrinkwrap only rename the package-lock.json to npm-shrinkwrap.json if it exists. When package-lock.json does not exist, the npm-shrinkwrap.json file is created from the existing dependencies tree (which represent the committed package-lock.json file, without the dev dependencies)

from branch-name-lint.

yoavain avatar yoavain commented on August 17, 2024

@barzik
I can open a PR with the above change, but let me know if the solution is accepted

from branch-name-lint.

Related Issues (15)

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.