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

penumbra-watch

v1.2.3

Published

Watch files for penumbra

Readme

penumbra-watch

Install

npm install --save penumbra-watch

Or if you are working locally, but don't want penumbra-watch as a dependency.

npm install --save-dev penumbra-watch

Usage

Install penumbra, and vinyl-fs to do this example.

var pen = require('penumbra')(),
    //Make sure to pass the pen instance into the penumbra watch function.
    watch = require('penumbra-watch')(pen),
    fs = require('vinyl-fs');


pen.task('move', function * (){
    console.log('moving files');
    yield [
        fs.src(['./*.js']),
        map(log),
        fs.dest('./output')
    ];
});

watch('.', {
    cwd: process.cwd()
}, 'move');

watch can also be simply called as:

watch('.', 'move', 'anotherTask');

or

watch('.', function(){

}, /*... more functions, or penumbra tasks.*/);

Interface

require('penumbra-watch')(pen) -> watch

Pass a penumbra instance to the pen argument to use tasks in the watch constructor.

If you don't you can still use a callback, but you won't be able to use tasks directly in the watch function.

watch(files, options, callback|task, ..., task) -> chokidar watcher

files can be one of these:

  • file name
  • file glob
  • array of file names, or globs

options are the same as chokidar.

The rest of the arguments can be a callback, or a task string.

penumbra tasks will be run before callbacks.

Look at chokidar to learn more.

Use with a callback

var pen = require('penumbra')(),
    watch = require('penumbra-watch')(pen),
    fs = require('vinyl-fs');


pen.task('move', function * (){
    console.log('moving files');
    yield [
        fs.src(['./*.js']),
        map(log),
        fs.dest('./output')
    ];
});

watch('.', {
    cwd: process.cwd()
}, function(){
    console.log('ready to move');
    pen.exec('move').then(function(){
        console.log('done moving');
    });
});

Use with browser-sync

var bs = require('browser-sync').create(),
    reload = bs.reload,
    pen = require('penumbra')(),
    watch = require('penumbra-watch')(pen);

pen.task('serve', function * (){
    bs.init({server: '.'});
    //Here callback functions, and penumbra tasks are mixed.
    watch('.', reload, 'anotherTask', console.log.bind(console));
});

pen.task('anotherTask', function * (){
    /*This task is run before the reload callback.*/
    console.log('anotherTask is running');
    /*... Do some stuff here.*/
});

About

Use this module with penumbra.

If you would like a similar, but different interface then gulp-watch will also work with penumbra. chokidar itself will also work quite well.

penumbra-watch is just a little module to help decrease the code to start a file watcher using penumbra.