Configure via files
It seems like this feature is wished by some people, as they have tried implementing configuration via files at least twice: #102 #66
This issue is a formalization, so we can discuss what the best strategy is; to me, none of these PRs has hit the sweet spot yet.
@filipesilva, do you have any ideas?
I like the combination of CLI args + package.json or .concurrentlyrc.
In the past, I liked the idea of using rc, but it adds a configuration surface area that is too large.
I think having a config file makes sense in general, but realistically the only flags that would be shared across several commands are the general options (--no-color, --name-separator, --prefix-colors, --timestamp-format and --prefix-length).
The other options (--kill-others, --kill-others-on-fail, etc) are always going to be specific to the script being used, so it's likely enough that there would be more than one config file. That or we allow config merging.
i like foreman appropach ... in this case it would be something like this:
config params --kill-others, --kill-others-on-fail, --success, --prefix, --timestamp-format, --prefix-length, --color, --raw, --allow-restart, --restart-after and --restart-tries would be defined in package.json or by cli.
params --names, --prefix-colors and commands would be moved to 'Procfile'
so instead of:
concurrently --kill-others --success last --names \"server,client\" --prefix-colors \"white.bgBlue,white.bgMagenta\" \"npm run watch\" \"npm run electron-start\"
i would have this:
concurrently --kill-others --success last and in 'Procfile'
server:white.bgBlue:npm run watch
client:white.bgMagenta:npm run electron-start
Hello!
Thank you for this great tool!
However, my command line looks very ugly, it doesn't "fit" into package.json and is unreadable:
concurrently --names database,build,run --prefix '[{name}] ({time})' --prefix-colors cyan,yellow,green --timestamp-format HH:mm:ss --kill-others npm:compose:database:up npm:build:watch npm:server:start:watch
It would be very useful to be able to extract it into a config file:
{
"commands": {
"database": {
"script": "npm:compose:database:up",
"color": "cyan"
},
"build": {
"script": "npm:build:watch",
"color": "yellow"
},
"run": {
"script": "npm:server:start:watch",
"color": "green"
}
},
"options": {
"prefix": "[{name}] ({time})",
"timestamp": "HH:mm:ss",
"killOthers": true
}
}
Then, it could be executed like this:
concurrently --config ./dev/concurrently.json database build run
Why not integrate with the common cosmiconfig package instead? I would be able to create a PR if that would help accelerate this!
+1 for js config files, e.g. .concurrently.js and concurrently.config.js
... or expose an api to js
Why not the config and/or pkgConf options from yargs?
-
config()Adds--configoption to specify a path to JSON config file. -
pkgConf('concurrently')Readsconcurrentlyproperty from package.json as config.