Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

150
Vistas
Automatically update package.json version and read it in code

I have logger which is displaying some stuff in production and i want to add version to this logger so i got better clue if/when deployment is finished. Is it possible to:

  1. Update package.json version on merge
  2. Read this version in code and add it to the logger

That will be really helpful

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

for the second question if you have access to process you can read the version property of package.json like this:

process.env.npm_package_version

for the first question, that is a little tricky, you can use some packages such as husky to run some npm scripts which you already add to package.json.

so you would listen to git hooks such as commit or merge and using pre- or post- scripts to run a command before or after a hook is fired.

so I guess if you can combine these, you would get your desired result

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda