npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

monitor_mt

v1.0.6

Published

Módulo para notificaciones y generación de versiones.

Readme

monitor_mt

jp_monitor es un módulo diseñado para notificar el estado de despliegues y reinicios de servicios mediante un webhook. También genera un archivo de versión (monitor_version.json) que identifica de manera única cada despliegue.


Instalación

Instala el módulo en tu proyecto:

npm install monitor_mt

Uso

1. Generar el archivo de versión

El archivo monitor_version.json se genera automáticamente durante la construcción de la imagen Docker. Este archivo contiene un identificador único (version) y una marca de tiempo (timestamp) que representan el despliegue actual.

Si deseas generar el archivo manualmente (por ejemplo, para pruebas locales), puedes ejecutar el siguiente comando:

npx monitor-mt generate-version

Esto generará un archivo monitor_version.json en el directorio raíz del proyecto.


2. Notificar al webhook

Para enviar el contenido del archivo monitor_version.json a un webhook, puedes usar la función notifyDeploymentStatus:

const { notifyDeploymentStatus } = require('jp_monitor');

const webhookUrl = 'https://example.com/webhook';

notifyDeploymentStatus(webhookUrl)
    .then(() => console.log('Webhook enviado correctamente.'))
    .catch((error) => console.error('Error al enviar el webhook:', error));

Integración con Docker

Dockerfile

El archivo de versión se genera automáticamente durante la construcción de la imagen Docker. Asegúrate de incluir el siguiente comando en tu Dockerfile:

RUN npx jp_monitor generate-version

Ejemplo completo del Dockerfile:

FROM node:18-alpine as builder

WORKDIR /app/server

COPY ./package*.json ./

RUN npm install 
RUN npx monitor-mt generate-version

COPY . .

RUN npm run build

CMD [ "/bin/sh", "start.sh" ]

Flujo de despliegue

  1. Construcción de la imagen Docker: Durante la construcción de la imagen, el archivo monitor_version.json se genera automáticamente mediante el comando nnpx monitor-mt generate-version.

  2. Inicio del contenedor: Cuando el contenedor se inicia, el script start.sh se ejecuta para iniciar la aplicación:

    # start.sh
    #!/bin/bash
    npm run migration:run
    node dist/main.js
  3. Notificación al webhook: La aplicación puede enviar el contenido del archivo monitor_version.json al webhook configurado para notificar el estado del despliegue.


Ejemplo de archivo monitor_version.json

El archivo generado tendrá el siguiente formato:

{
  "version": "123e4567-e89b-12d3-a456-426614174000",
  "timestamp": "2025-05-02T12:00:00.000Z"
}

Notas importantes

  • Generación única por despliegue: El archivo monitor_version.json se genera durante la construcción de la imagen Docker, asegurando que sea único para cada despliegue.
  • Reinicios del contenedor: Si el contenedor se reinicia, el archivo de versión no se regenera, lo que permite identificar si se trata de un nuevo despliegue o un reinicio.

Si tienes preguntas o necesitas ayuda, ¡no dudes en abrir un issue o contactarme!