Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

165
Views
Is there an easy way to manage state in a node/JS module by using programatically parts of npm logic?

Let's say we want to replicate part of the functionality npm has, namely, we want to know if node_modules is synced with the current state of package.json and package-lock.json, so that, if it's not, launch npm ci (if possible also programatically). Essentially we don't want to incur into the penalty of running npm ci (which can take several seconds) but do something a bit less simplistic than checking the date of node_modules against package.json.

I have checked out the dependencies of npm, and there does not seem to be one that carries that logic. arborist is more related to dependencies and its storage, pacote deals with packages. So it must be something in npm itself. Also, according to this answer we shouldn't really try and run npm from outside the CLI so I wonder if that kind of logic (which is probably used elsewhere, like yarn or grunt) is available from some other package.

At the end of the day, I want a logic similar to the one used by make: update stuff if downstream dependencies have changed somehow. node_modules vs. package.json is an example... But there could be use cases where we would also need it. At the end of the day, what I'm looking for are off-the-shelf node.js modules that would help me create a make-like tool in JavaScript.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!