concurrently icon indicating copy to clipboard operation
concurrently copied to clipboard

Configure via files

Open gustavohenke opened this issue 8 years ago • 7 comments

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.

gustavohenke avatar Apr 29 '17 12:04 gustavohenke

@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.

gustavohenke avatar Apr 29 '17 12:04 gustavohenke

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.

filipesilva avatar Apr 29 '17 12:04 filipesilva

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

CzBuCHi avatar Jun 29 '17 07:06 CzBuCHi

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

slavafomin avatar Feb 24 '20 19:02 slavafomin

Why not integrate with the common cosmiconfig package instead? I would be able to create a PR if that would help accelerate this!

wyattjoh avatar Mar 25 '21 18:03 wyattjoh

+1 for js config files, e.g. .concurrently.js and concurrently.config.js ... or expose an api to js

milahu avatar May 08 '21 06:05 milahu

Why not the config and/or pkgConf options from yargs?

  • config() Adds --config option to specify a path to JSON config file.
  • pkgConf('concurrently') Reads concurrently property from package.json as config.

Lalem001 avatar May 26 '23 17:05 Lalem001