@ryanburnette/spawn-in-parallel
v1.0.1
Published
Spawn development tasks in parallel.
Downloads
3
Readme
spawn-in-parallel
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