Easily fork node process to run scripts concurrently
Sometimes you want to run multiple node processes at once. For example
- Type-checking command like
tsc --project src
- Bundler command like
parcel src --out-dir build
- Server starting command like
onchange build --initial -- node build/start.js
There are several ways to solve this:
Make npm/yarn scripts and run them independently
- Probably the "healthy" way. But it is annoying to open terminals and run these command one by one.
- Using exposed APIs is usually takes more effort than CLI commands.
command1 & command2 & command3 & ...
SIGTERMdoes not kill all processes.
easy-fork, you can pass multiple CLI commands to run them concurrently, and now all you have to do is run the script.
$ npm install easy-fork
$ yarn add easy-fork
const fork = ;;;;
Command to run. Must be locally installed node CLI.
MIT © Hoishin