Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

166
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda