concurrently 6.3.0 → 6.4.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 +18 -14
- package/bin/concurrently.js +9 -1
- package/bin/concurrently.spec.js +20 -0
- package/index.js +1 -0
- package/package.json +1 -1
- package/src/defaults.js +2 -0
- package/src/logger.js +9 -1
- package/src/logger.spec.js +28 -0
package/README.md
CHANGED
|
@@ -116,21 +116,25 @@ Help:
|
|
|
116
116
|
concurrently [options] <command ...>
|
|
117
117
|
|
|
118
118
|
General
|
|
119
|
-
-m, --max-processes
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
-n, --names
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
-r, --raw
|
|
128
|
-
|
|
129
|
-
-s, --success
|
|
130
|
-
|
|
131
|
-
|
|
119
|
+
-m, --max-processes How many processes should run at once.
|
|
120
|
+
New processes only spawn after all restart tries of a
|
|
121
|
+
process. [number]
|
|
122
|
+
-n, --names List of custom names to be used in prefix template.
|
|
123
|
+
Example names: "main,browser,server" [string]
|
|
124
|
+
--name-separator The character to split <names> on. Example usage:
|
|
125
|
+
concurrently -n "styles|scripts|server" --name-separator
|
|
126
|
+
"|" [default: ","]
|
|
127
|
+
-r, --raw Output only raw output of processes, disables
|
|
128
|
+
prettifying and concurrently coloring. [boolean]
|
|
129
|
+
-s, --success Return exit code of zero or one based on the success or
|
|
130
|
+
failure of the "first" child to terminate, the "last
|
|
131
|
+
child", or succeed only if "all" child processes
|
|
132
|
+
succeed.
|
|
132
133
|
[choices: "first", "last", "all"] [default: "all"]
|
|
133
|
-
|
|
134
|
+
--no-color Disables colors from logging [boolean]
|
|
135
|
+
--hide Comma-separated list of processes to hide the output.
|
|
136
|
+
The processes can be identified by their name or index.
|
|
137
|
+
[string] [default: ""]
|
|
134
138
|
|
|
135
139
|
Prefix styling
|
|
136
140
|
-p, --prefix Prefix used in logging for each process.
|
package/bin/concurrently.js
CHANGED
|
@@ -55,6 +55,13 @@ const args = yargs
|
|
|
55
55
|
describe: 'Disables colors from logging',
|
|
56
56
|
type: 'boolean'
|
|
57
57
|
},
|
|
58
|
+
'hide': {
|
|
59
|
+
describe:
|
|
60
|
+
'Comma-separated list of processes to hide the output.\n' +
|
|
61
|
+
'The processes can be identified by their name or index.',
|
|
62
|
+
default: defaults.hide,
|
|
63
|
+
type: 'string'
|
|
64
|
+
},
|
|
58
65
|
|
|
59
66
|
// Kill others
|
|
60
67
|
'k': {
|
|
@@ -135,7 +142,7 @@ const args = yargs
|
|
|
135
142
|
'Can be either the index or the name of the process.'
|
|
136
143
|
}
|
|
137
144
|
})
|
|
138
|
-
.group(['m', 'n', 'name-separator', 'raw', 's', 'no-color'], 'General')
|
|
145
|
+
.group(['m', 'n', 'name-separator', 'raw', 's', 'no-color', 'hide'], 'General')
|
|
139
146
|
.group(['p', 'c', 'l', 't'], 'Prefix styling')
|
|
140
147
|
.group(['i', 'default-input-target'], 'Input handling')
|
|
141
148
|
.group(['k', 'kill-others-on-fail'], 'Killing other processes')
|
|
@@ -157,6 +164,7 @@ concurrently(args._.map((command, index) => ({
|
|
|
157
164
|
: (args.killOthersOnFail ? ['failure'] : []),
|
|
158
165
|
maxProcesses: args.maxProcesses,
|
|
159
166
|
raw: args.raw,
|
|
167
|
+
hide: args.hide.split(','),
|
|
160
168
|
prefix: args.prefix,
|
|
161
169
|
prefixColors: args.prefixColors.split(','),
|
|
162
170
|
prefixLength: args.prefixLength,
|
package/bin/concurrently.spec.js
CHANGED
|
@@ -163,6 +163,26 @@ describe('--raw', () => {
|
|
|
163
163
|
});
|
|
164
164
|
});
|
|
165
165
|
|
|
166
|
+
describe('--hide', () => {
|
|
167
|
+
it('hides the output of a process by its index', done => {
|
|
168
|
+
const child = run('--hide 1 "echo foo" "echo bar"');
|
|
169
|
+
child.log.pipe(buffer(child.close)).subscribe(lines => {
|
|
170
|
+
expect(lines).toContainEqual(expect.stringContaining('foo'));
|
|
171
|
+
expect(lines).not.toContainEqual(expect.stringContaining('bar'));
|
|
172
|
+
done();
|
|
173
|
+
}, done);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it('hides the output of a process by its name', done => {
|
|
177
|
+
const child = run('-n foo,bar --hide bar "echo foo" "echo bar"');
|
|
178
|
+
child.log.pipe(buffer(child.close)).subscribe(lines => {
|
|
179
|
+
expect(lines).toContainEqual(expect.stringContaining('foo'));
|
|
180
|
+
expect(lines).not.toContainEqual(expect.stringContaining('bar'));
|
|
181
|
+
done();
|
|
182
|
+
}, done);
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
|
|
166
186
|
describe('--names', () => {
|
|
167
187
|
it('is aliased to -n', done => {
|
|
168
188
|
const child = run('-n foo,bar "echo foo" "echo bar"');
|
package/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const Logger = require('./src/logger');
|
|
|
11
11
|
|
|
12
12
|
module.exports = exports = (commands, options = {}) => {
|
|
13
13
|
const logger = new Logger({
|
|
14
|
+
hide: options.hide,
|
|
14
15
|
outputStream: options.outputStream || process.stdout,
|
|
15
16
|
prefixFormat: options.prefix,
|
|
16
17
|
prefixLength: options.prefixLength,
|
package/package.json
CHANGED
package/src/defaults.js
CHANGED
|
@@ -10,6 +10,8 @@ module.exports = {
|
|
|
10
10
|
handleInput: false,
|
|
11
11
|
// How many processes to run at once
|
|
12
12
|
maxProcesses: 0,
|
|
13
|
+
// Indices and names of commands whose output to be not logged
|
|
14
|
+
hide: '',
|
|
13
15
|
nameSeparator: ',',
|
|
14
16
|
// Which prefix style to use when logging processes output.
|
|
15
17
|
prefix: '',
|
package/src/logger.js
CHANGED
|
@@ -5,7 +5,11 @@ const formatDate = require('date-fns/format');
|
|
|
5
5
|
const defaults = require('./defaults');
|
|
6
6
|
|
|
7
7
|
module.exports = class Logger {
|
|
8
|
-
constructor({ outputStream, prefixFormat, prefixLength, raw, timestampFormat }) {
|
|
8
|
+
constructor({ hide, outputStream, prefixFormat, prefixLength, raw, timestampFormat }) {
|
|
9
|
+
// To avoid empty strings from hiding the output of commands that don't have a name,
|
|
10
|
+
// keep in the list of commands to hide only strings with some length.
|
|
11
|
+
// This might happen through the CLI when no `--hide` argument is specified, for example.
|
|
12
|
+
this.hide = _.castArray(hide).filter(name => name || name === 0).map(String);
|
|
9
13
|
this.raw = raw;
|
|
10
14
|
this.outputStream = outputStream;
|
|
11
15
|
this.prefixFormat = prefixFormat;
|
|
@@ -76,6 +80,10 @@ module.exports = class Logger {
|
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
logCommandText(text, command) {
|
|
83
|
+
if (this.hide.includes(String(command.index)) || this.hide.includes(command.name)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
79
87
|
const prefix = this.colorText(command, this.getPrefix(command));
|
|
80
88
|
return this.log(prefix + (prefix ? ' ' : ''), text);
|
|
81
89
|
}
|
package/src/logger.spec.js
CHANGED
|
@@ -176,6 +176,20 @@ describe('#logCommandText()', () => {
|
|
|
176
176
|
|
|
177
177
|
expect(logger.log).toHaveBeenCalledWith(chalk.hex(prefixColor)('[1]') + ' ', 'foo');
|
|
178
178
|
});
|
|
179
|
+
|
|
180
|
+
it('does nothing if command is hidden by name', () => {
|
|
181
|
+
const logger = createLogger({ hide: ['abc'] });
|
|
182
|
+
logger.logCommandText('foo', { name: 'abc' });
|
|
183
|
+
|
|
184
|
+
expect(logger.log).not.toHaveBeenCalled();
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('does nothing if command is hidden by index', () => {
|
|
188
|
+
const logger = createLogger({ hide: [3] });
|
|
189
|
+
logger.logCommandText('foo', { index: 3 });
|
|
190
|
+
|
|
191
|
+
expect(logger.log).not.toHaveBeenCalled();
|
|
192
|
+
});
|
|
179
193
|
});
|
|
180
194
|
|
|
181
195
|
describe('#logCommandEvent()', () => {
|
|
@@ -186,6 +200,20 @@ describe('#logCommandEvent()', () => {
|
|
|
186
200
|
expect(logger.log).not.toHaveBeenCalled();
|
|
187
201
|
});
|
|
188
202
|
|
|
203
|
+
it('does nothing if command is hidden by name', () => {
|
|
204
|
+
const logger = createLogger({ hide: ['abc'] });
|
|
205
|
+
logger.logCommandEvent('foo', { name: 'abc' });
|
|
206
|
+
|
|
207
|
+
expect(logger.log).not.toHaveBeenCalled();
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('does nothing if command is hidden by index', () => {
|
|
211
|
+
const logger = createLogger({ hide: [3] });
|
|
212
|
+
logger.logCommandEvent('foo', { index: 3 });
|
|
213
|
+
|
|
214
|
+
expect(logger.log).not.toHaveBeenCalled();
|
|
215
|
+
});
|
|
216
|
+
|
|
189
217
|
it('logs text in gray dim', () => {
|
|
190
218
|
const logger = createLogger();
|
|
191
219
|
logger.logCommandEvent('foo', { index: 1 });
|