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 🙏

© 2025 – Pkg Stats / Ryan Hefner

pm2-deploysmith

v1.1.1

Published

CLI tool to generate PM2 post-deploy command using symlinks to get zero-downtime deployments

Readme

🛠️ pm2-deploysmith

CLI tool to generate a PM2 post-deploy command using the standard releases/ + current/ symlink pattern.

Built for Node.js environments using pnpm, pm2, and optionally nvm.

CI npm version npm downloads license node built with pnpm open issues codecov


🚀 What It Does

Generates a one-liner post-deploy command for your ecosystem.config.js, which:

  • creates a timestamped release folder (e.g., releases/build-202507111402)
  • copies code from source/ to new release directory
  • installs dependencies using pnpm
  • compiles your code using a build:staging or build:production script from package.json
  • sets current/ symlink
  • reloads pm2
  • deletes old builds (keeps last n, default: 4)

🧑‍💻 Installation

pnpm add -g pm2-deploysmith

🏃 Usage

pm2-deploysmith demo

Interactive mode:

pm2-deploysmith

This will prompt you to enter:

  • system user (e.g., ubuntu)
  • project sub-directory (e.g., my-app)
  • environment (e.g., production)

With CLI flags (no prompts):

pm2-deploysmith --systemUser ubuntu --projectSubDir my-app --environment production

Additional optional flags:

--numOfKeptReleases - how many old releases to keep (default: 4)

--skipSourceNvm - if you don't want to run source ~/.nvm/nvm.sh first

--addSourceProfile - if you want to run source ~/.profile first

Example:

pm2-deploysmith \
  --systemUser ubuntu \
  --projectSubDir my-app \
  --environment production \
  --numOfKeptReleases 6 \
  --skipSourceNvm \
  --addSourceProfile

🧪 Output

You wiil get a full post-deploy command like this:


source ~/.profile \
&& BUILD_TIMESTAMP=$(date +%Y%m%d%H%M) \
&& mkdir -p /home/ubuntu/my-app/releases/build-$BUILD_TIMESTAMP \
&& cp -a /home/ubuntu/my-app/source/. /home/ubuntu/my-app/releases/build-$BUILD_TIMESTAMP/ \
&& cd /home/ubuntu/my-app/releases/build-$BUILD_TIMESTAMP/ \
&& nvm install \
&& nvm use \
&& npm install -g pnpm \
&& npm install -g pm2 \
&& pnpm install \
&& pnpm build:production \
&& rm /home/ubuntu/my-app/current \
&& ln -sfn /home/ubuntu/my-app/releases/build-$BUILD_TIMESTAMP /home/ubuntu/my-app/current \
&& cd /home/ubuntu/my-app/current \
&& pm2 reload ecosystem.config.js --env production --cwd /home/ubuntu/my-app/current \
&& ls -dt /home/ubuntu/my-app/releases/* | tail -n +4 | xargs rm -rf

Copy-paste that into your ecosystem.config.js:

module.exports = {
  apps: [...],
  deploy: {
    production: {
      user: 'ubuntu',
      host: 'your-server',
      ref: 'origin/master',
      repo: '[email protected]:you/your-repo.git',
      path: '/home/ubuntu/my-app',
      'post-deploy': '<< PASTE OUTPUT HERE >>'
    }
  }
}

Upgrades and versioning

pnpm version patch  # or minor or major
git push --follow-tags

Manual publishing

pnpm publish --access public

📄 License MIT © 2025 goodylabs