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

childminder

v1.1.2

Published

Promise based child process manager for development

Downloads

8

Readme

childminder

childminder is a promise based child process manager for development.

NPM Version Build Status

import { Childminder } from 'childminder';

const cm = new Childminder();
const child = cm.create('echo', ['Hello, world'], {
  prefix: 'greeting',
  prefixColor: 12,
});

child.restart();

Features

  • Colorful console prefix
  • Preserve child process console message color
  • Handle multiple processes

Motivation

nodemon is a useful tool in node.js server programming. It watches file changes and restarts node.js process automatically. If we use transpilers like Babel, CoffeeScript or TypeScript, however, process should not restart when file changes but when transpilation is completed. Maybe in this case, we should monitor events from transpiler and reload process manually.

childminder is yet another tool for development like nodemon, but does not watch file changes. When using childminder, you should call childminder process restart function manually, which looks cumbersome but indeed is a clear way.

API

Class: Childminder

Process manager that contains multiple Child instances.

Childminder#create(command[, args][, options]) => Child

Create Child instance.

  • command String The command to run
  • args Array List of string arguments
  • options Object
    • cwd String Current working directory of the child process
    • env Object Environment key-value pairs
    • prefix String stdout message prefix
    • prefixColor Number Prefix xTerm colors
    • stdout stream.Writable Child's stdout stream (Default: process.stdout)
    • lazy Boolean If true, Child process does not start running when created (Default: false)
  • returns Child instance.

Class: Child

Thin wrapper of node.js ChildProcess object, which supports restart. Child instance is created by Childminder#create method.

Child#startOrRestart() => Promise<void>

Starts or restarts child process. Returned promise is resolved when the previous process exits and new process gets started.

Child#restart() => Promise<void>

Restarts running child process. Returned promise is resolved when the previous process exits and new process gets started.

Child#waitForExit() => Promise<void>

Wait for child process to terminate. Returned promise is resolved when the process exits.

Child#isRunning() => boolean

Returns if the child process is running.

Child#kill(signal = 'SIGHUP') => Promise<void>

Kill child process and wait for it to terminate. Returned promise is resolved when the process exits.

License

MIT