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 🙏

© 2024 – Pkg Stats / Ryan Hefner

cach

v1.0.6

Published

A simple program to restart your NodeJS app when it exits with an error.

Downloads

14

Readme

Cach

Discord Travis CI Depfu npm

A simple program to restart your NodeJS app when it exits with an error. Useful for Discord bots.

Installation

For global use:

$ npm install -g cach

For local use:

$ npm install --save cach

Usage

On the command line:

$ cach
Running `npm start`...

$ cach ember serve
Running `ember serve`...

In a script:

var cach = require("cach");

// Runs npm start with cach
cach();

// Runs ember serve with cach
cach("ember serve");

// Runs npm test with cach,
// and also logs messages
cach("npm test", true);

Testing

$ git clone https://github.com/bottza/cach
Cloning into 'cach'...
remote: Counting objects: 37, done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 37 (delta 13), reused 23 (delta 3), pack-reused 0
Unpacking objects: 100% (37/37), done.

$ cd cach

$ npm test
> [email protected] test C:\Programming\cach
> ava

  4 tests passed

Comparison to PM2

Cach:

$ cach
Running `npm start`...

Ok. How do I stop it? Ctrl-C is intuitive...

^C
$ 

It worked!!!!

PM2:

$ pm2 start node main.js
[PM2] Spawning PM2 daemon with pm2_home=C:\Users\archmaster\.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting D:\Documents\Programmimg\BootBot\main.js in fork_mode (1 instance)
[PM2] Done.
┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────┬───────────┬───────┬──────────┐
│ App name │ id │ mode │ pid   │ status │ restart │ uptime │ cpu │ mem       │ user  │ watching │
├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────┼───────────┼───────┼──────────┤
│ main     │ 0  │ fork │ 24268 │ online │ 0       │ 0s     │ 0%  │ 29.0 MB   │ felix │ disabled │
└──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────┴───────────┴───────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app

Wait AAAAAAAHHH so confusing! How do I know what's happening? How do I even stop it? It's not running in my terminal so I can't do Ctrl-C! Reads help. Sooo...

$ pm2 stop 0
[PM2] Applying action stopProcessId on app [0](ids: 0)
[PM2] [node](0) ✓
┌──────────┬────┬──────┬─────┬─────────┬─────────┬────────┬─────┬────────┬───────┬──────────┐
│ App name │ id │ mode │ pid │ status  │ restart │ uptime │ cpu │ mem    │ user  │ watching │
├──────────┼────┼──────┼─────┼─────────┼─────────┼────────┼─────┼────────┼───────┼──────────┤
│ node     │ 0  │ fork │ 0   │ stopped │ 0       │ 0      │ 0%  │ 0 B    │ felix │ disabled │
└──────────┴────┴──────┴─────┴─────────┴─────────┴────────┴─────┴────────┴───────┴──────────┘
Use `pm2 show <id|name>` to get more details about an app

Well... it's stopped... but it's still showing up! Imma install cach.