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

run-on-output

v1.1.0

Published

Execute tasks when CLI output patterns are detected

Readme

run-on-output

Execute tasks when CLI output patterns are detected

Build Status npm version Node.js XO code style License

⭐ If you like this project, star it on GitHub!

FeaturesInstallationUsageExamples

A lightweight Node.js CLI tool that monitors command output in real-time and triggers actions when specific patterns are found. Perfect for automation workflows, development environments, and CI/CD pipelines.

Features

  • 🎯 Pattern Matching - Monitor stdout/stderr for regex patterns or plain strings
  • Real-time Monitoring - Output is forwarded in real-time while monitoring
  • 🔧 Flexible Actions - Display messages or execute commands when patterns match
  • 📝 Multiple Patterns - Wait for multiple patterns before triggering actions
  • 🚀 Zero Dependencies - Built with Node.js built-in modules only

Installation

npm install -g run-on-output

Or use without installing:

npx run-on-output [options] <command> [args...]

Usage

Basic Examples

Display a message when server starts:

run-on-output -s "Server started" -m "🚀 Server is ready" npm start

Execute a health check when server is listening:

run-on-output -p "listening on port \\d+" -r "curl http://localhost:3000/health" node server.js

Monitor development environment startup:

run-on-output -s "webpack compiled,server ready" -m "✅ Development environment ready" npm run dev

Multiple actions - show message and open browser:

run-on-output -s "ready" -m "Server is up" -r "open http://localhost:3000" npm start

Run npm script when server is ready:

run-on-output -s "Server running" -n "test" node server.js

[!TIP] You can use the short alias roo instead of run-on-output for faster typing:

roo -s "Server started" -m "🚀 Server is ready" npm start

Command Line Options

run-on-output [OPTIONS] <command> [args...]

OPTIONS:
  -p, --patterns <patterns>    Comma-separated list of regex patterns to watch for
  -s, --strings <strings>      Comma-separated list of plain strings to watch for
  -r, --run <command>          Command to execute after all patterns are found
  -n, --npm <script>           npm script to run after all patterns are found
  -m, --message <text>         Message to display after all patterns are found
  -h, --help                   Show this help message

REQUIREMENTS:
  - Either --patterns or --strings must be specified (but not both)
  - At least one of --run, --npm, or --message must be specified

Pattern Types

Plain Strings (-s, --strings)

  • Matches exact text (case-insensitive)
  • Easier to use for simple text matching
  • Example: -s "Server started,Database connected"

Regex Patterns (-p, --patterns)

  • Use regular expressions for complex matching
  • Supports all JavaScript regex features
  • Example: -p "listening on port \\d+,ready in \\d+ms"

Examples

Development Workflow

# Wait for both webpack and server, then open browser
run-on-output -s "webpack compiled,Local:" -r "open http://localhost:3000" npm run dev

# Monitor test runner and show completion message
run-on-output -s "Tests completed" -m "✅ All tests passed" npm test

CI/CD Pipeline

# Wait for deployment completion and run smoke tests
run-on-output -p "deployment.*complete" -r "./scripts/smoke-test.sh" deploy.sh

# Monitor build process and trigger notifications
run-on-output -s "Build successful" -r "slack-notify '#dev' 'Build completed'" npm run build

Docker & Containers

# Wait for container health check and run integration tests
run-on-output -s "healthy" -r "npm run test:integration" docker-compose up

# Monitor database initialization
run-on-output -p "database.*ready" -m "📁 Database initialized" ./start-db.sh

API Development

# Wait for API server and run endpoint tests
run-on-output -p "server.*listening.*port" -r "npm run test:api" node api.js

# Monitor microservices startup and run deployment script
run-on-output -s "auth-service ready,user-service ready" -n "deploy" ./start-services.sh

# Combine message, command and npm script
run-on-output -s "Database connected" -m "🎉 Ready for testing" -n "test:integration" npm start