concurrently 7.4.0 → 7.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -5
- package/dist/bin/concurrently.js +3 -3
- package/dist/bin/epilogue.js +8 -0
- package/dist/src/command.d.ts +1 -1
- package/dist/src/concurrently.js +3 -4
- package/dist/src/flow-control/input-handler.d.ts +1 -4
- package/dist/src/prefix-color-selector.d.ts +11 -0
- package/dist/src/prefix-color-selector.js +92 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -191,8 +191,9 @@ Prefix styling
|
|
|
191
191
|
- Available modifiers: reset, bold, dim, italic,
|
|
192
192
|
underline, inverse, hidden, strikethrough
|
|
193
193
|
- Available colors: black, red, green, yellow, blue,
|
|
194
|
-
magenta, cyan, white, gray
|
|
195
|
-
|
|
194
|
+
magenta, cyan, white, gray,
|
|
195
|
+
any hex values for colors (e.g. #23de43) or auto for
|
|
196
|
+
an automatically picked color
|
|
196
197
|
- Available background colors: bgBlack, bgRed,
|
|
197
198
|
bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite
|
|
198
199
|
See https://www.npmjs.com/package/chalk for more
|
|
@@ -250,6 +251,14 @@ Examples:
|
|
|
250
251
|
$ concurrently --names "HTTP,WATCH" -c "bgBlue.bold,bgMagenta.bold"
|
|
251
252
|
"http-server" "npm run watch"
|
|
252
253
|
|
|
254
|
+
- Auto varying colored prefixes
|
|
255
|
+
|
|
256
|
+
$ concurrently -c "auto" "npm run watch" "http-server"
|
|
257
|
+
|
|
258
|
+
- Mixing auto and manual colored prefixes
|
|
259
|
+
|
|
260
|
+
$ concurrently -c "red,auto" "npm run watch" "http-server" "echo hello"
|
|
261
|
+
|
|
253
262
|
- Configuring via environment variables with CONCURRENTLY_ prefix
|
|
254
263
|
|
|
255
264
|
$ CONCURRENTLY_RAW=true CONCURRENTLY_KILL_OTHERS=true concurrently "echo
|
|
@@ -324,12 +333,12 @@ For more details, visit https://github.com/open-cli-tools/concurrently
|
|
|
324
333
|
- `prefix`: the prefix type to use when logging processes output.
|
|
325
334
|
Possible values: `index`, `pid`, `time`, `command`, `name`, `none`, or a template (eg `[{time} process: {pid}]`).
|
|
326
335
|
Default: the name of the process, or its index if no name is set.
|
|
327
|
-
- `prefixColors`: a list of colors as supported by [chalk](https://www.npmjs.com/package/chalk).
|
|
328
|
-
If concurrently would run more commands than there are colors, the last color is repeated.
|
|
336
|
+
- `prefixColors`: a list of colors as supported by [chalk](https://www.npmjs.com/package/chalk) or `auto` for an automatically picked color.
|
|
337
|
+
If concurrently would run more commands than there are colors, the last color is repeated, unless if the last color value is `auto` which means following colors are automatically picked to vary.
|
|
329
338
|
Prefix colors specified per-command take precedence over this list.
|
|
330
339
|
- `prefixLength`: how many characters to show when prefixing with `command`. Default: `10`
|
|
331
340
|
- `raw`: whether raw mode should be used, meaning strictly process output will
|
|
332
|
-
be logged, without any prefixes,
|
|
341
|
+
be logged, without any prefixes, coloring or extra stuff.
|
|
333
342
|
- `successCondition`: the condition to consider the run was successful.
|
|
334
343
|
If `first`, only the first process to exit will make up the success of the run; if `last`, the last process that exits will determine whether the run succeeds.
|
|
335
344
|
Anything else means all processes should exit successfully.
|
package/dist/bin/concurrently.js
CHANGED
|
@@ -87,7 +87,7 @@ const args = (0, yargs_1.default)(argsBeforeSep)
|
|
|
87
87
|
'and concurrently coloring.',
|
|
88
88
|
type: 'boolean',
|
|
89
89
|
},
|
|
90
|
-
// This one is provided for free. Chalk reads this itself and removes
|
|
90
|
+
// This one is provided for free. Chalk reads this itself and removes colors.
|
|
91
91
|
// https://www.npmjs.com/package/chalk#chalksupportscolor
|
|
92
92
|
'no-color': {
|
|
93
93
|
describe: 'Disables colors from logging',
|
|
@@ -140,8 +140,8 @@ const args = (0, yargs_1.default)(argsBeforeSep)
|
|
|
140
140
|
describe: 'Comma-separated list of chalk colors to use on prefixes. ' +
|
|
141
141
|
'If there are more commands than colors, the last color will be repeated.\n' +
|
|
142
142
|
'- Available modifiers: reset, bold, dim, italic, underline, inverse, hidden, strikethrough\n' +
|
|
143
|
-
'- Available colors: black, red, green, yellow, blue, magenta, cyan, white, gray \n' +
|
|
144
|
-
'
|
|
143
|
+
'- Available colors: black, red, green, yellow, blue, magenta, cyan, white, gray, \n' +
|
|
144
|
+
'any hex values for colors (e.g. #23de43) or auto for an automatically picked color\n' +
|
|
145
145
|
'- Available background colors: bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite\n' +
|
|
146
146
|
'See https://www.npmjs.com/package/chalk for more information.',
|
|
147
147
|
default: defaults.prefixColors,
|
package/dist/bin/epilogue.js
CHANGED
|
@@ -20,6 +20,14 @@ const examples = [
|
|
|
20
20
|
description: 'Custom names and colored prefixes',
|
|
21
21
|
example: '$ $0 --names "HTTP,WATCH" -c "bgBlue.bold,bgMagenta.bold" "http-server" "npm run watch"',
|
|
22
22
|
},
|
|
23
|
+
{
|
|
24
|
+
description: 'Auto varying colored prefixes',
|
|
25
|
+
example: '$ $0 -c "auto" "npm run watch" "http-server"',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
description: 'Mixing auto and manual colored prefixes',
|
|
29
|
+
example: '$ $0 -c "red,auto" "npm run watch" "http-server" "echo hello"',
|
|
30
|
+
},
|
|
23
31
|
{
|
|
24
32
|
description: 'Configuring via environment variables with CONCURRENTLY_ prefix',
|
|
25
33
|
example: '$ CONCURRENTLY_RAW=true CONCURRENTLY_KILL_OTHERS=true $0 "echo hello" "echo world"',
|
package/dist/src/command.d.ts
CHANGED
package/dist/src/concurrently.js
CHANGED
|
@@ -16,6 +16,7 @@ const strip_quotes_1 = require("./command-parser/strip-quotes");
|
|
|
16
16
|
const completion_listener_1 = require("./completion-listener");
|
|
17
17
|
const get_spawn_opts_1 = require("./get-spawn-opts");
|
|
18
18
|
const output_writer_1 = require("./output-writer");
|
|
19
|
+
const prefix_color_selector_1 = require("./prefix-color-selector");
|
|
19
20
|
const defaults = {
|
|
20
21
|
spawn: spawn_command_1.default,
|
|
21
22
|
kill: tree_kill_1.default,
|
|
@@ -33,6 +34,7 @@ function concurrently(baseCommands, baseOptions) {
|
|
|
33
34
|
assert_1.default.ok(Array.isArray(baseCommands), '[concurrently] commands should be an array');
|
|
34
35
|
assert_1.default.notStrictEqual(baseCommands.length, 0, '[concurrently] no commands provided');
|
|
35
36
|
const options = lodash_1.default.defaults(baseOptions, defaults);
|
|
37
|
+
const prefixColorSelector = new prefix_color_selector_1.PrefixColorSelector(options.prefixColors);
|
|
36
38
|
const commandParsers = [
|
|
37
39
|
new strip_quotes_1.StripQuotes(),
|
|
38
40
|
new expand_npm_shortcut_1.ExpandNpmShortcut(),
|
|
@@ -41,16 +43,13 @@ function concurrently(baseCommands, baseOptions) {
|
|
|
41
43
|
if (options.additionalArguments) {
|
|
42
44
|
commandParsers.push(new expand_arguments_1.ExpandArguments(options.additionalArguments));
|
|
43
45
|
}
|
|
44
|
-
let lastColor = '';
|
|
45
46
|
let commands = (0, lodash_1.default)(baseCommands)
|
|
46
47
|
.map(mapToCommandInfo)
|
|
47
48
|
.flatMap((command) => parseCommand(command, commandParsers))
|
|
48
49
|
.map((command, index) => {
|
|
49
|
-
// Use documented behaviour of repeating last color when specifying more commands than colors
|
|
50
|
-
lastColor = (options.prefixColors && options.prefixColors[index]) || lastColor;
|
|
51
50
|
return new command_1.Command({
|
|
52
51
|
index,
|
|
53
|
-
prefixColor:
|
|
52
|
+
prefixColor: prefixColorSelector.getNextColor(),
|
|
54
53
|
...command,
|
|
55
54
|
}, (0, get_spawn_opts_1.getSpawnOpts)({
|
|
56
55
|
raw: options.raw,
|
|
@@ -25,9 +25,6 @@ export declare class InputHandler implements FlowController {
|
|
|
25
25
|
});
|
|
26
26
|
handle(commands: Command[]): {
|
|
27
27
|
commands: Command[];
|
|
28
|
-
onFinish?: undefined;
|
|
29
|
-
} | {
|
|
30
|
-
commands: Command[];
|
|
31
|
-
onFinish: () => void;
|
|
28
|
+
onFinish?: () => void | undefined;
|
|
32
29
|
};
|
|
33
30
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
export declare class PrefixColorSelector {
|
|
3
|
+
private colorGenerator;
|
|
4
|
+
constructor(customColors?: string[]);
|
|
5
|
+
/** A list of colors that are readable in a terminal. */
|
|
6
|
+
static get ACCEPTABLE_CONSOLE_COLORS(): ("stderr" | keyof chalk.Chalk | "supportsColor" | "Level" | "Color" | "ForegroundColor" | "BackgroundColor" | "Modifiers")[];
|
|
7
|
+
/**
|
|
8
|
+
* @returns The given custom colors then a set of acceptable console colors indefinitely.
|
|
9
|
+
*/
|
|
10
|
+
getNextColor(): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrefixColorSelector = void 0;
|
|
4
|
+
function getConsoleColorsWithoutCustomColors(customColors) {
|
|
5
|
+
return PrefixColorSelector.ACCEPTABLE_CONSOLE_COLORS.filter(
|
|
6
|
+
// Consider the "Bright" variants of colors to be the same as the plain color to avoid similar colors
|
|
7
|
+
(color) => !customColors.includes(color.replace(/Bright$/, '')));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates a generator that yields an infinite stream of colors.
|
|
11
|
+
*/
|
|
12
|
+
function* createColorGenerator(customColors) {
|
|
13
|
+
// Custom colors should be used as is, except for "auto"
|
|
14
|
+
const nextAutoColors = getConsoleColorsWithoutCustomColors(customColors);
|
|
15
|
+
let lastColor;
|
|
16
|
+
for (const customColor of customColors) {
|
|
17
|
+
let currentColor = customColor;
|
|
18
|
+
if (currentColor !== 'auto') {
|
|
19
|
+
yield currentColor; // Manual color
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
// Find the first auto color that is not the same as the last color
|
|
23
|
+
while (currentColor === 'auto' || lastColor === currentColor) {
|
|
24
|
+
if (!nextAutoColors.length) {
|
|
25
|
+
// There could be more "auto" values than auto colors so this needs to be able to refill
|
|
26
|
+
nextAutoColors.push(...PrefixColorSelector.ACCEPTABLE_CONSOLE_COLORS);
|
|
27
|
+
}
|
|
28
|
+
currentColor = nextAutoColors.shift();
|
|
29
|
+
}
|
|
30
|
+
yield currentColor; // Auto color
|
|
31
|
+
}
|
|
32
|
+
lastColor = currentColor;
|
|
33
|
+
}
|
|
34
|
+
const lastCustomColor = customColors[customColors.length - 1] || '';
|
|
35
|
+
if (lastCustomColor !== 'auto') {
|
|
36
|
+
while (true) {
|
|
37
|
+
yield lastCustomColor; // If last custom color was not "auto" then return same color forever, to maintain existing behaviour
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Finish the initial set(s) of auto colors to avoid repetition
|
|
41
|
+
for (const color of nextAutoColors) {
|
|
42
|
+
yield color;
|
|
43
|
+
}
|
|
44
|
+
// Yield an infinite stream of acceptable console colors
|
|
45
|
+
//
|
|
46
|
+
// If the given custom colors use every ACCEPTABLE_CONSOLE_COLORS except one then there is a chance a color will be repeated,
|
|
47
|
+
// however its highly unlikely and low consequence so not worth the extra complexity to account for it
|
|
48
|
+
while (true) {
|
|
49
|
+
for (const color of PrefixColorSelector.ACCEPTABLE_CONSOLE_COLORS) {
|
|
50
|
+
yield color; // Repeat colors forever
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
class PrefixColorSelector {
|
|
55
|
+
constructor(customColors = []) {
|
|
56
|
+
this.colorGenerator = createColorGenerator(customColors);
|
|
57
|
+
}
|
|
58
|
+
/** A list of colors that are readable in a terminal. */
|
|
59
|
+
static get ACCEPTABLE_CONSOLE_COLORS() {
|
|
60
|
+
// Colors picked randomly, can be amended if required
|
|
61
|
+
return [
|
|
62
|
+
// Prevent duplicates, in case the list becomes significantly large
|
|
63
|
+
...new Set([
|
|
64
|
+
// Text colors
|
|
65
|
+
'cyan',
|
|
66
|
+
'yellow',
|
|
67
|
+
'greenBright',
|
|
68
|
+
'blueBright',
|
|
69
|
+
'magentaBright',
|
|
70
|
+
'white',
|
|
71
|
+
'grey',
|
|
72
|
+
'red',
|
|
73
|
+
// Background colors
|
|
74
|
+
'bgCyan',
|
|
75
|
+
'bgYellow',
|
|
76
|
+
'bgGreenBright',
|
|
77
|
+
'bgBlueBright',
|
|
78
|
+
'bgMagenta',
|
|
79
|
+
'bgWhiteBright',
|
|
80
|
+
'bgGrey',
|
|
81
|
+
'bgRed',
|
|
82
|
+
]),
|
|
83
|
+
];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @returns The given custom colors then a set of acceptable console colors indefinitely.
|
|
87
|
+
*/
|
|
88
|
+
getNextColor() {
|
|
89
|
+
return this.colorGenerator.next().value;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.PrefixColorSelector = PrefixColorSelector;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "concurrently",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.0",
|
|
4
4
|
"description": "Run commands concurrently",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@hirez_io/observer-spy": "^2.2.0",
|
|
64
64
|
"@swc/core": "^1.2.224",
|
|
65
65
|
"@swc/jest": "^0.2.21",
|
|
66
|
-
"@types/jest": "^28.1.
|
|
66
|
+
"@types/jest": "^28.1.8",
|
|
67
67
|
"@types/lodash": "^4.14.178",
|
|
68
68
|
"@types/node": "^16.11.47",
|
|
69
69
|
"@types/shell-quote": "^1.7.1",
|
|
@@ -77,16 +77,16 @@
|
|
|
77
77
|
"eslint": "^8.21.0",
|
|
78
78
|
"eslint-config-prettier": "^8.5.0",
|
|
79
79
|
"eslint-plugin-import": "^2.26.0",
|
|
80
|
-
"eslint-plugin-jest": "^
|
|
80
|
+
"eslint-plugin-jest": "^27.0.4",
|
|
81
81
|
"eslint-plugin-prettier": "^4.0.0",
|
|
82
|
-
"eslint-plugin-simple-import-sort": "^
|
|
82
|
+
"eslint-plugin-simple-import-sort": "^8.0.0",
|
|
83
83
|
"jest": "^28.1.3",
|
|
84
84
|
"jest-create-mock-instance": "^2.0.0",
|
|
85
85
|
"lint-staged": "^12.4.1",
|
|
86
86
|
"prettier": "^2.6.2",
|
|
87
87
|
"simple-git-hooks": "^2.7.0",
|
|
88
88
|
"string-argv": "^0.3.1",
|
|
89
|
-
"typescript": "
|
|
89
|
+
"typescript": "~4.8.3"
|
|
90
90
|
},
|
|
91
91
|
"files": [
|
|
92
92
|
"dist",
|