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

grunt-run-node

v0.1.7

Published

Start and stop node asynchronously from your grunt build.

Downloads

18,361

Readme

grunt-run-node

Build status Dependency Status devDependency Status Code Climate

Start and stop node asynchronously from your grunt build.

Grunt task to simplify testing by asynchrounously starting and stopping one or more node servers during the grunt build. This plugin contains two separate tasks run_node and stop_node. run_nodewill typically be used before test to start the system under test and stop_node will typically be used once the tests have been completed.

NPM

Getting Started

This plugin requires Grunt ^1.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-run-node --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-run-node');

The "run_node" task

Overview

In your project's Gruntfile, add a section named run_node to the data object passed into grunt.initConfig() to start one or more node servers asynchronously. To stop previously started node servers use the stop_node task.

grunt.initConfig({
    run_node: {
        start: {
            options: {
                cwd: 'test',
                stdio: [ 'ignore', 'ignore', 'ignore' ],
                env: {
                    'foo': 'bar'
                },
                detached: true
            },
            files: { src: [ 'server/server.js'] }
        }
    },
    stop_node: {
        stop: {}
    }
});

Options

options.cwd

Type: String

Default value: process.cwd()

Used to set the current working directory for the executing node processes.

options.stdio

Type: String

Default value: [ 'ignore', (grunt.option('verbose') ? process.stdout : 'ignore'), process.stderr ]

The stdio option is an array where each index corresponds to a stream in the node process.

The value is one of the following:

  • pipe - Create a pipe between the child process and the parent process. The parent end of the pipe is exposed to the parent as a property on the child_process object as ChildProcess.stdio[file descriptor]. Pipes created for file descriptors 0 - 2 are also available as ChildProcess.stdin, ChildProcess.stdout and ChildProcess.stderr, respectively.
  • ipc - Create an IPC channel for passing messages/file descriptors between parent and child. A ChildProcess may have at most one IPC stdio file descriptor. Setting this option enables the ChildProcess.send() method. If the child writes JSON messages to this file descriptor, then this will trigger ChildProcess.on('message'). If the child is a Node.js program, then the presence of an IPC channel will enable process.send() and process.on('message').
  • ignore - Do not set this file descriptor in the child. Note that Node will always open file descriptor 0 - 2 for the processes it spawns. When any of these is ignored node will open /dev/null and attach it to the child's file descriptor.
  • Stream object - Share a readable or writable stream that refers to a tty, file, socket, or a pipe with the child process. The stream's underlying file descriptor is duplicated in the child process to the file descriptor that corresponds to the index in the stdio array. Note that the stream must have an underlying descriptor (file streams do not until the 'open' event has occurred).
  • Positive integer - The integer value is interpreted as a file descriptor that is is currently open in the parent process. It is shared with the child process, similar to how Stream objects can be shared.
  • null or undefined - Use default value. For stdio file descriptors 0, 1 and 2 (in other words, stdin, stdout, and stderr) a pipe is created. For file descriptor 3 and up, the default is 'ignore'.

As a shorthand, the stdio argument may also be one of the following strings, rather than an array:

  • 'ignore' - ['ignore', 'ignore', 'ignore']
  • 'pipe' - ['pipe', 'pipe', 'pipe']
  • 'inherit' - [process.stdin, process.stdout, process.stderr] or [0,1,2]

options.env

Type: Object

Default value: {}

Env can be used to specify environment key-value variables that will be visible to the new process.

options.detached

Type: Boolean

Default value: false

If the detached option is set, the child process will be made the leader of a new process group. This makes it possible for the child to continue running after the parent exits.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • 2014-03-05   v0.1.0   Released run_node and stop_node tasks
  • 2015-06-19   v0.1.1   Improved options support & updated dependencies
  • 2015-07-30   v0.1.2   Multiple minor tweaks
  • 2015-07-30   v0.1.3   More minor tweaks and fixes
  • 2016-07-27   v0.1.4   Updating dependencies
  • 2016-07-27   v0.1.5   Downgraded version of sleep to fix build
  • 2016-10-09   v0.1.6   Downgrading version of grunt
  • 2017-04-29   v0.1.7   Updated build & other badges

James D Bloom