1.0.1 • Published 5 years ago

@ryanburnette/spawn-in-parallel v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

spawn-in-parallel

repo npm

Spawn your development tasks in parallel. When you kill your script, the spawned processes also die. Works on macOS, Linux, and Windows. This makes use of Node.js and child_process.spawn with helpful defaults.

Usage

Let's say you have two things you want spinning when you're in development.

hugo server -D -p 3000
npx webpack --config webpack.development.js --watch

Make a scripts/development file like this.

Simple...

#!/usr/bin/env node
require('@ryanburnette/spawn-in-parallel')([
  'hugo server -D -p 3000',
   'npx webpack --config webpack.development.js --watch'
]);

This demonstrates all the available options...

#!/usr/bin/env node
require('@ryanburnette/spawn-in-parallel')([
  'hugo server -D -p 3000',
  {
    cmd: 'npx webpack --config webpack.development.js --watch',
    opts: {
      // per cmd opts for spawn here
    }
  } 
], {
  // put custom opts for spawn here
});

Make it executable.

chmod +x scripts/development

Get to work.

scripts/development