1 | const InputHandler = require('./src/flow-control/input-handler');
|
2 | const KillOnSignal = require('./src/flow-control/kill-on-signal');
|
3 | const KillOthers = require('./src/flow-control/kill-others');
|
4 | const LogError = require('./src/flow-control/log-error');
|
5 | const LogExit = require('./src/flow-control/log-exit');
|
6 | const LogOutput = require('./src/flow-control/log-output');
|
7 | const RestartProcess = require('./src/flow-control/restart-process');
|
8 |
|
9 | const concurrently = require('./src/concurrently');
|
10 | const Logger = require('./src/logger');
|
11 | const LogTimings = require( './src/flow-control/log-timings' );
|
12 |
|
13 | module.exports = exports = (commands, options = {}) => {
|
14 | const logger = new Logger({
|
15 | hide: options.hide,
|
16 | outputStream: options.outputStream || process.stdout,
|
17 | prefixFormat: options.prefix,
|
18 | prefixLength: options.prefixLength,
|
19 | raw: options.raw,
|
20 | timestampFormat: options.timestampFormat,
|
21 | });
|
22 |
|
23 | return concurrently(commands, {
|
24 | maxProcesses: options.maxProcesses,
|
25 | raw: options.raw,
|
26 | successCondition: options.successCondition,
|
27 | cwd: options.cwd,
|
28 | controllers: [
|
29 | new LogError({ logger }),
|
30 | new LogOutput({ logger }),
|
31 | new LogExit({ logger }),
|
32 | new InputHandler({
|
33 | logger,
|
34 | defaultInputTarget: options.defaultInputTarget,
|
35 | inputStream: options.inputStream || (options.handleInput && process.stdin),
|
36 | pauseInputStreamOnFinish: options.pauseInputStreamOnFinish,
|
37 | }),
|
38 | new KillOnSignal({ process }),
|
39 | new RestartProcess({
|
40 | logger,
|
41 | delay: options.restartDelay,
|
42 | tries: options.restartTries,
|
43 | }),
|
44 | new KillOthers({
|
45 | logger,
|
46 | conditions: options.killOthers
|
47 | }),
|
48 | new LogTimings({
|
49 | logger: options.timings ? logger: null,
|
50 | timestampFormat: options.timestampFormat,
|
51 | })
|
52 | ],
|
53 | prefixColors: options.prefixColors || [],
|
54 | timings: options.timings
|
55 | });
|
56 | };
|
57 |
|
58 |
|
59 |
|
60 | exports.concurrently = concurrently;
|
61 | exports.Logger = Logger;
|
62 | exports.InputHandler = InputHandler;
|
63 | exports.KillOnSignal = KillOnSignal;
|
64 | exports.KillOthers = KillOthers;
|
65 | exports.LogError = LogError;
|
66 | exports.LogExit = LogExit;
|
67 | exports.LogOutput = LogOutput;
|
68 | exports.RestartProcess = RestartProcess;
|
69 | exports.LogTimings = LogTimings;
|