concurrently
Advanced tools
Comparing version 6.2.2 to 6.3.0
@@ -147,15 +147,8 @@ #!/usr/bin/env node | ||
const prefixColors = args.prefixColors.split(','); | ||
const names = (args.names || '').split(args.nameSeparator); | ||
let lastColor; | ||
concurrently(args._.map((command, index) => { | ||
// Use documented behaviour of repeating last colour when specifying more commands than colours | ||
lastColor = prefixColors[index] || lastColor; | ||
return { | ||
command, | ||
prefixColor: lastColor, | ||
name: names[index] | ||
}; | ||
}), { | ||
concurrently(args._.map((command, index) => ({ | ||
command, | ||
name: names[index] | ||
})), { | ||
handleInput: args.handleInput, | ||
@@ -169,2 +162,3 @@ defaultInputTarget: args.defaultInputTarget, | ||
prefix: args.prefix, | ||
prefixColors: args.prefixColors.split(','), | ||
prefixLength: args.prefixLength, | ||
@@ -174,3 +168,3 @@ restartDelay: args.restartAfter, | ||
successCondition: args.success, | ||
timestampFormat: args.timestampFormat | ||
timestampFormat: args.timestampFormat, | ||
}).then( | ||
@@ -177,0 +171,0 @@ () => process.exit(0), |
@@ -46,3 +46,4 @@ const InputHandler = require('./src/flow-control/input-handler'); | ||
}) | ||
] | ||
], | ||
prefixColors: options.prefixColors || [] | ||
}); | ||
@@ -49,0 +50,0 @@ }; |
{ | ||
"name": "concurrently", | ||
"version": "6.2.2", | ||
"version": "6.3.0", | ||
"description": "Run commands concurrently", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -253,2 +253,5 @@ # Concurrently | ||
Default: the name of the process, or its index if no name is set. | ||
- `prefixColors`: a list of colors as supported by [chalk](https://www.npmjs.com/package/chalk). | ||
If concurrently would run more commands than there are colors, the last color is repeated. | ||
Prefix colors specified per-command take precedence over this list. | ||
- `prefixLength`: how many characters to show when prefixing with `command`. Default: `10` | ||
@@ -255,0 +258,0 @@ - `raw`: whether raw mode should be used, meaning strictly process output will |
@@ -35,17 +35,23 @@ const assert = require('assert'); | ||
let lastColor = ''; | ||
commands = _(commands) | ||
.map(mapToCommandInfo) | ||
.flatMap(command => parseCommand(command, commandParsers)) | ||
.map((command, index) => new Command( | ||
Object.assign({ | ||
index, | ||
spawnOpts: getSpawnOpts({ | ||
raw: options.raw, | ||
env: command.env, | ||
cwd: command.cwd || options.cwd, | ||
}), | ||
killProcess: options.kill, | ||
spawn: options.spawn, | ||
}, command) | ||
)) | ||
.map((command, index) => { | ||
// Use documented behaviour of repeating last color when specifying more commands than colors | ||
lastColor = options.prefixColors && options.prefixColors[index] || lastColor; | ||
return new Command( | ||
Object.assign({ | ||
index, | ||
spawnOpts: getSpawnOpts({ | ||
raw: options.raw, | ||
env: command.env, | ||
cwd: command.cwd || options.cwd, | ||
}), | ||
prefixColor: lastColor, | ||
killProcess: options.kill, | ||
spawn: options.spawn, | ||
}, command) | ||
); | ||
}) | ||
.value(); | ||
@@ -79,9 +85,10 @@ | ||
function mapToCommandInfo(command) { | ||
return { | ||
return Object.assign({ | ||
command: command.command || command, | ||
name: command.name || '', | ||
prefixColor: command.prefixColor || '', | ||
env: command.env || {}, | ||
cwd: command.cwd || '', | ||
}; | ||
}, command.prefixColor ? { | ||
prefixColor: command.prefixColor, | ||
} : {}); | ||
} | ||
@@ -88,0 +95,0 @@ |
@@ -87,2 +87,15 @@ const EventEmitter = require('events'); | ||
it('runs commands with a list of colors', () => { | ||
create(['echo', 'kill'], { | ||
prefixColors: ['red'] | ||
}); | ||
controllers.forEach(controller => { | ||
expect(controller.handle).toHaveBeenCalledWith([ | ||
expect.objectContaining({ command: 'echo', prefixColor: 'red' }), | ||
expect.objectContaining({ command: 'kill', prefixColor: 'red' }), | ||
]); | ||
}); | ||
}); | ||
it('passes commands wrapped from a controller to the next one', () => { | ||
@@ -89,0 +102,0 @@ const fakeCommand = createFakeCommand('banana', 'banana'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103824
2170
308