Very often when working on full stack solutions we find ourselves opening 4+ tabs in our terminal. We would run a yarn dev
for on micro-service then a yarn start
for react and so on.
This has always been annoying to handle and so we built Child Manager
which lets you manager child processes for your project from just a simple config file.
https://github.com/pixiumdigital/child-manager/
Installation
To install run the following commands:
yarn add @pixium-digital/child-manager
You can also use NPM
npm install @pixium-digital/child-manager
Run
To leverage child manager simply add a configuration file to your project (see below for config details)
You can run thew following command:
yarn child-manager
By default the loaded config will be at the source of the project and be named childmanager.json
If you wish to load a different file just pass the config option.
yarn child-manager --config="./myconfig.json"
You can then access the manager at the following:
Configuration
Here is an example configuration
{
"processes": [
{
"name": "Test Service",
"command": {
"executor": "node",
"args": ["TestService.js"],
"path": "./src/service",
"isWindows": false
},
"maxLogs": 200
},
{
"name": "Service 2",
"command": {
"executor": "yarn",
"args": ["start"],
"path": "./other-project/service",
"isWindows": false
},
"maxLogs": 200
}
],
"captureExit": true,
"longLive": false,
"debug": false
}
Generic configurations:
-
debug
: This will show more logs in the terminal in case something is not working -
longLive
: This is to force process to stay alive. Use carefully. -
captureExit
: This binds the exit of child manager so that it will kill all childs
Process configurations:
-
name
: The name of your service maxLogs
: The max number of logs to keep in memory (recommended 200)-
command
: This houses the command line that will be launched-
executor
: The command executor (yarn, npm, node) -
args
: Array or extra arguments that should be passed -
path
: Where the command should be executed -
isWindows
: Is this running on windows system? if yes paths and executors will be automatically changed to be compatible
-
Conclusion
With the use of one simple configuration file we are now able to launch all our mini services efficiently and with ease regardless of the fact that it might be a yarn script
a npm script
or even a command line
If you wish to contribute feel free to check out the code:
https://github.com/pixiumdigital/child-manager/
About Us
Pixium Digital