0

In my project, I maintain support for both npm and yarn.

At present, whenever I update file package.json, I conduct the following process:

  1. Delete file package-lock.json
  2. Delete file yarn.lock
  3. Delete folder node_modules
  4. Run npm install
  5. Delete folder node_modules
  6. Run yarn install

This process seems to guarantee deterministic results for both file package-lock.json and file yarn.lock.

But on the other hand, it is a little "tedious" to conduct it every time I want to update my project dependencies.

Is there a simple process that I can take instead?

I have read through this answer; it covers this topic pretty well, but not the simplification that I am looking for.

Thank you for your help.

  • What are the benefits of supporting both `npm` and `yarn` for you? It's much easier to enforce the agreement for all project developers to use only one package manager. – Anatoly Feb 06 '22 at 12:30
  • @Anatoly: The benefits are actually described pretty well in the answer that I have linked: `If your project is open-source, the most community-friendly thing to do would probably be to commit both and have an automated process to ensure yarn.lock and package-lock.json always stay in sync`. –  Feb 06 '22 at 12:40

0 Answers0