concurrently 7.2.0 → 7.3.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.
Files changed (34) hide show
  1. package/README.md +82 -67
  2. package/dist/bin/concurrently.js +16 -10
  3. package/dist/bin/epilogue.js +16 -15
  4. package/dist/src/command-parser/expand-arguments.d.ts +5 -1
  5. package/dist/src/command-parser/expand-arguments.js +3 -5
  6. package/dist/src/command-parser/expand-npm-shortcut.js +3 -3
  7. package/dist/src/command-parser/expand-npm-wildcard.js +11 -27
  8. package/dist/src/command-parser/strip-quotes.d.ts +5 -1
  9. package/dist/src/command-parser/strip-quotes.js +2 -3
  10. package/dist/src/command.d.ts +5 -2
  11. package/dist/src/command.js +6 -3
  12. package/dist/src/completion-listener.d.ts +2 -2
  13. package/dist/src/completion-listener.js +16 -16
  14. package/dist/src/concurrently.js +13 -10
  15. package/dist/src/flow-control/input-handler.d.ts +1 -1
  16. package/dist/src/flow-control/input-handler.js +8 -5
  17. package/dist/src/flow-control/kill-on-signal.js +1 -2
  18. package/dist/src/flow-control/kill-others.d.ts +1 -1
  19. package/dist/src/flow-control/kill-others.js +2 -4
  20. package/dist/src/flow-control/log-error.js +1 -2
  21. package/dist/src/flow-control/log-exit.js +0 -1
  22. package/dist/src/flow-control/log-output.js +0 -1
  23. package/dist/src/flow-control/log-timings.d.ts +3 -3
  24. package/dist/src/flow-control/log-timings.js +12 -12
  25. package/dist/src/flow-control/restart-process.d.ts +1 -1
  26. package/dist/src/flow-control/restart-process.js +9 -4
  27. package/dist/src/get-spawn-opts.d.ts +4 -1
  28. package/dist/src/get-spawn-opts.js +9 -2
  29. package/dist/src/logger.d.ts +2 -2
  30. package/dist/src/logger.js +13 -10
  31. package/dist/src/output-writer.d.ts +1 -1
  32. package/dist/src/output-writer.js +7 -5
  33. package/index.js +1 -0
  34. package/package.json +30 -27
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -24,9 +28,9 @@ const Rx = __importStar(require("rxjs"));
24
28
  const operators_1 = require("rxjs/operators");
25
29
  /**
26
30
  * Provides logic to determine whether lists of commands ran successfully.
27
- */
31
+ */
28
32
  class CompletionListener {
29
- constructor({ successCondition = 'all', scheduler }) {
33
+ constructor({ successCondition = 'all', scheduler, }) {
30
34
  this.successCondition = successCondition;
31
35
  this.scheduler = scheduler;
32
36
  }
@@ -37,24 +41,23 @@ class CompletionListener {
37
41
  else if (this.successCondition === 'last') {
38
42
  return events[events.length - 1].exitCode === 0;
39
43
  }
40
- else if (!/^!?command-.+$/.test(this.successCondition)) {
44
+ const commandSyntaxMatch = this.successCondition.match(/^!?command-(.+)$/);
45
+ if (commandSyntaxMatch == null) {
41
46
  // If not a `command-` syntax, then it's an 'all' condition or it's treated as such.
42
47
  return events.every(({ exitCode }) => exitCode === 0);
43
48
  }
44
49
  // Check `command-` syntax condition.
45
50
  // Note that a command's `name` is not necessarily unique,
46
51
  // in which case all of them must meet the success condition.
47
- const [, nameOrIndex] = this.successCondition.split('-');
48
- const targetCommandsEvents = events.filter(({ command, index }) => (command.name === nameOrIndex
49
- || index === Number(nameOrIndex)));
52
+ const nameOrIndex = commandSyntaxMatch[1];
53
+ const targetCommandsEvents = events.filter(({ command, index }) => command.name === nameOrIndex || index === Number(nameOrIndex));
50
54
  if (this.successCondition.startsWith('!')) {
51
55
  // All commands except the specified ones must exit succesfully
52
- return events.every((event) => (targetCommandsEvents.includes(event)
53
- || event.exitCode === 0));
56
+ return events.every(event => targetCommandsEvents.includes(event) || event.exitCode === 0);
54
57
  }
55
58
  // Only the specified commands must exit succesfully
56
- return targetCommandsEvents.length > 0
57
- && targetCommandsEvents.every(event => event.exitCode === 0);
59
+ return (targetCommandsEvents.length > 0 &&
60
+ targetCommandsEvents.every(event => event.exitCode === 0));
58
61
  }
59
62
  /**
60
63
  * Given a list of commands, wait for all of them to exit and then evaluate their exit codes.
@@ -63,12 +66,9 @@ class CompletionListener {
63
66
  */
64
67
  listen(commands) {
65
68
  const closeStreams = commands.map(command => command.close);
66
- return Rx.merge(...closeStreams)
67
- .pipe((0, operators_1.bufferCount)(closeStreams.length), (0, operators_1.switchMap)(exitInfos => this.isSuccess(exitInfos)
69
+ return Rx.lastValueFrom(Rx.merge(...closeStreams).pipe((0, operators_1.bufferCount)(closeStreams.length), (0, operators_1.switchMap)(exitInfos => this.isSuccess(exitInfos)
68
70
  ? Rx.of(exitInfos, this.scheduler)
69
- : Rx.throwError(exitInfos, this.scheduler)), (0, operators_1.take)(1))
70
- .toPromise();
71
+ : Rx.throwError(exitInfos, this.scheduler)), (0, operators_1.take)(1)));
71
72
  }
72
73
  }
73
74
  exports.CompletionListener = CompletionListener;
74
- ;
@@ -47,11 +47,12 @@ function concurrently(baseCommands, baseOptions) {
47
47
  .flatMap(command => parseCommand(command, commandParsers))
48
48
  .map((command, index) => {
49
49
  // Use documented behaviour of repeating last color when specifying more commands than colors
50
- lastColor = options.prefixColors && options.prefixColors[index] || lastColor;
51
- return new command_1.Command(Object.assign({
50
+ lastColor = (options.prefixColors && options.prefixColors[index]) || lastColor;
51
+ return new command_1.Command({
52
52
  index,
53
53
  prefixColor: lastColor,
54
- }, command), (0, get_spawn_opts_1.getSpawnOpts)({
54
+ ...command,
55
+ }, (0, get_spawn_opts_1.getSpawnOpts)({
55
56
  raw: options.raw,
56
57
  env: command.env,
57
58
  cwd: command.cwd || options.cwd,
@@ -66,7 +67,7 @@ function concurrently(baseCommands, baseOptions) {
66
67
  };
67
68
  }, { commands, onFinishCallbacks: [] });
68
69
  commands = handleResult.commands;
69
- if (options.logger) {
70
+ if (options.logger && options.outputStream) {
70
71
  const outputWriter = new output_writer_1.OutputWriter({
71
72
  outputStream: options.outputStream,
72
73
  group: options.group,
@@ -82,7 +83,7 @@ function concurrently(baseCommands, baseOptions) {
82
83
  const result = new completion_listener_1.CompletionListener({ successCondition: options.successCondition })
83
84
  .listen(commands)
84
85
  .finally(() => {
85
- handleResult.onFinishCallbacks.forEach((onFinish) => onFinish());
86
+ handleResult.onFinishCallbacks.forEach(onFinish => onFinish());
86
87
  });
87
88
  return {
88
89
  result,
@@ -90,7 +91,6 @@ function concurrently(baseCommands, baseOptions) {
90
91
  };
91
92
  }
92
93
  exports.concurrently = concurrently;
93
- ;
94
94
  function mapToCommandInfo(command) {
95
95
  if (typeof command === 'string') {
96
96
  return {
@@ -100,14 +100,17 @@ function mapToCommandInfo(command) {
100
100
  cwd: '',
101
101
  };
102
102
  }
103
- return Object.assign({
103
+ return {
104
104
  command: command.command,
105
105
  name: command.name || '',
106
106
  env: command.env || {},
107
107
  cwd: command.cwd || '',
108
- }, command.prefixColor ? {
109
- prefixColor: command.prefixColor,
110
- } : {});
108
+ ...(command.prefixColor
109
+ ? {
110
+ prefixColor: command.prefixColor,
111
+ }
112
+ : {}),
113
+ };
111
114
  }
112
115
  function parseCommand(command, parsers) {
113
116
  return parsers.reduce((commands, parser) => lodash_1.default.flatMap(commands, command => parser.parse(command)), lodash_1.default.castArray(command));
@@ -17,7 +17,7 @@ export declare class InputHandler implements FlowController {
17
17
  private readonly defaultInputTarget;
18
18
  private readonly inputStream;
19
19
  private readonly pauseInputStreamOnFinish;
20
- constructor({ defaultInputTarget, inputStream, pauseInputStreamOnFinish, logger }: {
20
+ constructor({ defaultInputTarget, inputStream, pauseInputStreamOnFinish, logger, }: {
21
21
  inputStream: Readable;
22
22
  logger: Logger;
23
23
  defaultInputTarget?: CommandIdentifier;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -33,7 +37,7 @@ const defaults = __importStar(require("../defaults"));
33
37
  * If the input doesn't start with a command identifier, it is then always sent to the default target.
34
38
  */
35
39
  class InputHandler {
36
- constructor({ defaultInputTarget, inputStream, pauseInputStreamOnFinish, logger }) {
40
+ constructor({ defaultInputTarget, inputStream, pauseInputStreamOnFinish, logger, }) {
37
41
  this.logger = logger;
38
42
  this.defaultInputTarget = defaultInputTarget || defaults.defaultInputTarget;
39
43
  this.inputStream = inputStream;
@@ -49,8 +53,8 @@ class InputHandler {
49
53
  const dataParts = data.split(/:(.+)/);
50
54
  const targetId = dataParts.length > 1 ? dataParts[0] : this.defaultInputTarget;
51
55
  const input = dataParts[1] || data;
52
- const command = commands.find(command => (command.name === targetId ||
53
- command.index.toString() === targetId.toString()));
56
+ const command = commands.find(command => command.name === targetId ||
57
+ command.index.toString() === targetId.toString());
54
58
  if (command && command.stdin) {
55
59
  command.stdin.write(input);
56
60
  }
@@ -70,4 +74,3 @@ class InputHandler {
70
74
  }
71
75
  }
72
76
  exports.InputHandler = InputHandler;
73
- ;
@@ -22,7 +22,7 @@ class KillOnSignal {
22
22
  commands: commands.map(command => {
23
23
  const closeStream = command.close.pipe((0, operators_1.map)(exitInfo => {
24
24
  const exitCode = caughtSignal === 'SIGINT' ? 0 : exitInfo.exitCode;
25
- return Object.assign({}, exitInfo, { exitCode });
25
+ return { ...exitInfo, exitCode };
26
26
  }));
27
27
  return new Proxy(command, {
28
28
  get(target, prop) {
@@ -34,4 +34,3 @@ class KillOnSignal {
34
34
  }
35
35
  }
36
36
  exports.KillOnSignal = KillOnSignal;
37
- ;
@@ -8,7 +8,7 @@ export declare type ProcessCloseCondition = 'failure' | 'success';
8
8
  export declare class KillOthers implements FlowController {
9
9
  private readonly logger;
10
10
  private readonly conditions;
11
- constructor({ logger, conditions }: {
11
+ constructor({ logger, conditions, }: {
12
12
  logger: Logger;
13
13
  conditions: ProcessCloseCondition | ProcessCloseCondition[];
14
14
  });
@@ -10,13 +10,12 @@ const operators_1 = require("rxjs/operators");
10
10
  * Sends a SIGTERM signal to all commands when one of the exits with a matching condition.
11
11
  */
12
12
  class KillOthers {
13
- constructor({ logger, conditions }) {
13
+ constructor({ logger, conditions, }) {
14
14
  this.logger = logger;
15
15
  this.conditions = lodash_1.default.castArray(conditions);
16
16
  }
17
17
  handle(commands) {
18
- const conditions = this.conditions.filter(condition => (condition === 'failure' ||
19
- condition === 'success'));
18
+ const conditions = this.conditions.filter(condition => condition === 'failure' || condition === 'success');
20
19
  if (!conditions.length) {
21
20
  return { commands };
22
21
  }
@@ -32,4 +31,3 @@ class KillOthers {
32
31
  }
33
32
  }
34
33
  exports.KillOthers = KillOthers;
35
- ;
@@ -11,11 +11,10 @@ class LogError {
11
11
  handle(commands) {
12
12
  commands.forEach(command => command.error.subscribe(event => {
13
13
  this.logger.logCommandEvent(`Error occurred when executing command: ${command.command}`, command);
14
- const errorText = String(event instanceof Error ? (event.stack || event) : event);
14
+ const errorText = String(event instanceof Error ? event.stack || event : event);
15
15
  this.logger.logCommandEvent(errorText, command);
16
16
  }));
17
17
  return { commands };
18
18
  }
19
19
  }
20
20
  exports.LogError = LogError;
21
- ;
@@ -16,4 +16,3 @@ class LogExit {
16
16
  }
17
17
  }
18
18
  exports.LogExit = LogExit;
19
- ;
@@ -17,4 +17,3 @@ class LogOutput {
17
17
  }
18
18
  }
19
19
  exports.LogOutput = LogOutput;
20
- ;
@@ -12,14 +12,14 @@ interface TimingInfo {
12
12
  * Logs timing information about commands as they start/stop and then a summary when all commands finish.
13
13
  */
14
14
  export declare class LogTimings implements FlowController {
15
- static mapCloseEventToTimingInfo({ command, timings, killed, exitCode }: CloseEvent): TimingInfo;
15
+ static mapCloseEventToTimingInfo({ command, timings, killed, exitCode, }: CloseEvent): TimingInfo;
16
16
  private readonly logger?;
17
17
  private readonly timestampFormat;
18
- constructor({ logger, timestampFormat }: {
18
+ constructor({ logger, timestampFormat, }: {
19
19
  logger?: Logger;
20
20
  timestampFormat?: string;
21
21
  });
22
- printExitInfoTimingTable(exitInfos: CloseEvent[]): CloseEvent[];
22
+ private printExitInfoTimingTable;
23
23
  handle(commands: Command[]): {
24
24
  commands: Command[];
25
25
  };
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -32,11 +36,11 @@ const defaults = __importStar(require("../defaults"));
32
36
  * Logs timing information about commands as they start/stop and then a summary when all commands finish.
33
37
  */
34
38
  class LogTimings {
35
- constructor({ logger, timestampFormat = defaults.timestampFormat }) {
39
+ constructor({ logger, timestampFormat = defaults.timestampFormat, }) {
36
40
  this.logger = logger;
37
41
  this.timestampFormat = timestampFormat;
38
42
  }
39
- static mapCloseEventToTimingInfo({ command, timings, killed, exitCode }) {
43
+ static mapCloseEventToTimingInfo({ command, timings, killed, exitCode, }) {
40
44
  const readableDurationMs = (timings.endDate.getTime() - timings.startDate.getTime()).toLocaleString();
41
45
  return {
42
46
  name: command.name,
@@ -47,17 +51,15 @@ class LogTimings {
47
51
  };
48
52
  }
49
53
  printExitInfoTimingTable(exitInfos) {
50
- var _a, _b;
51
54
  const exitInfoTable = (0, lodash_1.default)(exitInfos)
52
55
  .sortBy(({ timings }) => timings.durationSeconds)
53
56
  .reverse()
54
57
  .map(LogTimings.mapCloseEventToTimingInfo)
55
58
  .value();
56
- (_a = this.logger) === null || _a === void 0 ? void 0 : _a.logGlobalEvent('Timings:');
57
- (_b = this.logger) === null || _b === void 0 ? void 0 : _b.logTable(exitInfoTable);
59
+ this.logger.logGlobalEvent('Timings:');
60
+ this.logger.logTable(exitInfoTable);
58
61
  return exitInfos;
59
62
  }
60
- ;
61
63
  handle(commands) {
62
64
  if (!this.logger) {
63
65
  return { commands };
@@ -65,24 +67,22 @@ class LogTimings {
65
67
  // individual process timings
66
68
  commands.forEach(command => {
67
69
  command.timer.subscribe(({ startDate, endDate }) => {
68
- var _a, _b;
69
70
  if (!endDate) {
70
71
  const formattedStartDate = (0, format_1.default)(startDate, this.timestampFormat);
71
- (_a = this.logger) === null || _a === void 0 ? void 0 : _a.logCommandEvent(`${command.command} started at ${formattedStartDate}`, command);
72
+ this.logger.logCommandEvent(`${command.command} started at ${formattedStartDate}`, command);
72
73
  }
73
74
  else {
74
75
  const durationMs = endDate.getTime() - startDate.getTime();
75
76
  const formattedEndDate = (0, format_1.default)(endDate, this.timestampFormat);
76
- (_b = this.logger) === null || _b === void 0 ? void 0 : _b.logCommandEvent(`${command.command} stopped at ${formattedEndDate} after ${durationMs.toLocaleString()}ms`, command);
77
+ this.logger.logCommandEvent(`${command.command} stopped at ${formattedEndDate} after ${durationMs.toLocaleString()}ms`, command);
77
78
  }
78
79
  });
79
80
  });
80
81
  // overall summary timings
81
82
  const closeStreams = commands.map(command => command.close);
82
83
  const allProcessesClosed = Rx.merge(...closeStreams).pipe((0, operators_1.bufferCount)(closeStreams.length), (0, operators_1.take)(1));
83
- allProcessesClosed.subscribe((exitInfos) => this.printExitInfoTimingTable(exitInfos));
84
+ allProcessesClosed.subscribe(exitInfos => this.printExitInfoTimingTable(exitInfos));
84
85
  return { commands };
85
86
  }
86
87
  }
87
88
  exports.LogTimings = LogTimings;
88
- ;
@@ -10,7 +10,7 @@ export declare class RestartProcess implements FlowController {
10
10
  private readonly scheduler?;
11
11
  readonly delay: number;
12
12
  readonly tries: number;
13
- constructor({ delay, tries, logger, scheduler }: {
13
+ constructor({ delay, tries, logger, scheduler, }: {
14
14
  delay?: number;
15
15
  tries?: number;
16
16
  logger: Logger;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -27,7 +31,7 @@ const defaults = __importStar(require("../defaults"));
27
31
  * Restarts commands that fail up to a defined number of times.
28
32
  */
29
33
  class RestartProcess {
30
- constructor({ delay, tries, logger, scheduler }) {
34
+ constructor({ delay, tries, logger, scheduler, }) {
31
35
  this.logger = logger;
32
36
  this.delay = delay != null ? +delay : defaults.restartDelay;
33
37
  this.tries = tries != null ? +tries : defaults.restartTries;
@@ -38,7 +42,9 @@ class RestartProcess {
38
42
  if (this.tries === 0) {
39
43
  return { commands };
40
44
  }
41
- commands.map(command => command.close.pipe((0, operators_1.take)(this.tries), (0, operators_1.takeWhile)(({ exitCode }) => exitCode !== 0))).map((failure, index) => Rx.merge(
45
+ commands
46
+ .map(command => command.close.pipe((0, operators_1.take)(this.tries), (0, operators_1.takeWhile)(({ exitCode }) => exitCode !== 0)))
47
+ .map((failure, index) => Rx.merge(
42
48
  // Delay the emission (so that the restarts happen on time),
43
49
  // explicitly telling the subscriber that a restart is needed
44
50
  failure.pipe((0, operators_1.delay)(this.delay, this.scheduler), (0, operators_1.mapTo)(true)),
@@ -68,4 +74,3 @@ class RestartProcess {
68
74
  }
69
75
  }
70
76
  exports.RestartProcess = RestartProcess;
71
- ;
@@ -1,4 +1,7 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ /// <reference types="node" />
2
5
  import { SpawnOptions } from 'child_process';
3
6
  import supportsColor from 'supports-color';
4
7
  export declare const getSpawnOpts: ({ colorSupport, cwd, process, raw, env, }: {
@@ -26,5 +29,5 @@ export declare const getSpawnOpts: ({ colorSupport, cwd, process, raw, env, }: {
26
29
  /**
27
30
  * Map of custom environment variables to include in the spawn options.
28
31
  */
29
- env?: Record<string, any>;
32
+ env?: Record<string, unknown>;
30
33
  }) => SpawnOptions;
@@ -5,7 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getSpawnOpts = void 0;
7
7
  const supports_color_1 = __importDefault(require("supports-color"));
8
- const getSpawnOpts = ({ colorSupport = supports_color_1.default.stdout, cwd, process = global.process, raw = false, env = {}, }) => Object.assign({
8
+ const getSpawnOpts = ({ colorSupport = supports_color_1.default.stdout, cwd, process = global.process, raw = false, env = {}, }) => ({
9
9
  cwd: cwd || process.cwd(),
10
- }, raw && { stdio: 'inherit' }, /^win/.test(process.platform) && { detached: false }, { env: Object.assign(colorSupport ? { FORCE_COLOR: colorSupport.level } : {}, process.env, env) });
10
+ ...(raw && { stdio: 'inherit' }),
11
+ ...(/^win/.test(process.platform) && { detached: false }),
12
+ env: {
13
+ ...(colorSupport ? { FORCE_COLOR: colorSupport.level.toString() } : {}),
14
+ ...process.env,
15
+ ...env,
16
+ },
17
+ });
11
18
  exports.getSpawnOpts = getSpawnOpts;
@@ -19,7 +19,7 @@ export declare class Logger {
19
19
  command: Command | undefined;
20
20
  text: string;
21
21
  }>;
22
- constructor({ hide, prefixFormat, prefixLength, raw, timestampFormat }: {
22
+ constructor({ hide, prefixFormat, prefixLength, raw, timestampFormat, }: {
23
23
  /**
24
24
  * Which command(s) should have their output hidden.
25
25
  */
@@ -66,7 +66,7 @@ export declare class Logger {
66
66
  *
67
67
  * Each row is a single input item, and they are presented in the input order.
68
68
  */
69
- logTable(tableContents: any[]): void;
69
+ logTable(tableContents: unknown[]): void;
70
70
  log(prefix: string, text: string, command?: Command): void;
71
71
  emit(command: Command | undefined, text: string): void;
72
72
  }
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -29,7 +33,7 @@ const format_1 = __importDefault(require("date-fns/format"));
29
33
  const Rx = __importStar(require("rxjs"));
30
34
  const defaults = __importStar(require("./defaults"));
31
35
  class Logger {
32
- constructor({ hide, prefixFormat, prefixLength, raw = false, timestampFormat }) {
36
+ constructor({ hide, prefixFormat, prefixLength, raw = false, timestampFormat, }) {
33
37
  /**
34
38
  * Observable that emits when there's been output logged.
35
39
  * If `command` is is `undefined`, then the log is for a global event.
@@ -38,7 +42,9 @@ class Logger {
38
42
  // To avoid empty strings from hiding the output of commands that don't have a name,
39
43
  // keep in the list of commands to hide only strings with some length.
40
44
  // This might happen through the CLI when no `--hide` argument is specified, for example.
41
- this.hide = lodash_1.default.castArray(hide).filter(name => name || name === 0).map(String);
45
+ this.hide = lodash_1.default.castArray(hide)
46
+ .filter(name => name || name === 0)
47
+ .map(String);
42
48
  this.raw = raw;
43
49
  this.prefixFormat = prefixFormat;
44
50
  this.prefixLength = prefixLength || defaults.prefixLength;
@@ -52,8 +58,8 @@ class Logger {
52
58
  const prefixLength = this.prefixLength - ellipsis.length;
53
59
  const endLength = Math.floor(prefixLength / 2);
54
60
  const beginningLength = prefixLength - endLength;
55
- const beginnning = text.substring(0, beginningLength);
56
- const end = text.substring(text.length - endLength, text.length);
61
+ const beginnning = text.slice(0, beginningLength);
62
+ const end = text.slice(text.length - endLength, text.length);
57
63
  return beginnning + ellipsis + end;
58
64
  }
59
65
  getPrefixesFor(command) {
@@ -133,7 +139,7 @@ class Logger {
133
139
  const headers = {};
134
140
  const contentRows = tableContents.map(row => {
135
141
  const rowContents = [];
136
- Object.keys(row).forEach((col) => {
142
+ Object.keys(row).forEach(col => {
137
143
  if (!headers[col]) {
138
144
  headers[col] = {
139
145
  index: nextColIndex++,
@@ -149,9 +155,7 @@ class Logger {
149
155
  });
150
156
  return rowContents;
151
157
  });
152
- const headersFormatted = Object
153
- .keys(headers)
154
- .map(header => header.padEnd(headers[header].length, ' '));
158
+ const headersFormatted = Object.keys(headers).map(header => header.padEnd(headers[header].length, ' '));
155
159
  if (!headersFormatted.length) {
156
160
  // No columns exist.
157
161
  return;
@@ -196,4 +200,3 @@ class Logger {
196
200
  }
197
201
  }
198
202
  exports.Logger = Logger;
199
- ;
@@ -9,7 +9,7 @@ export declare class OutputWriter {
9
9
  private readonly group;
10
10
  readonly buffers: string[][];
11
11
  activeCommandIndex: number;
12
- constructor({ outputStream, group, commands }: {
12
+ constructor({ outputStream, group, commands, }: {
13
13
  outputStream: Writable;
14
14
  group: boolean;
15
15
  commands: Command[];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -25,14 +29,13 @@ const Rx = __importStar(require("rxjs"));
25
29
  * Class responsible for actually writing output onto a writable stream.
26
30
  */
27
31
  class OutputWriter {
28
- constructor({ outputStream, group, commands }) {
32
+ constructor({ outputStream, group, commands, }) {
29
33
  this.activeCommandIndex = 0;
30
34
  this.outputStream = outputStream;
31
35
  this.group = group;
32
36
  this.buffers = commands.map(() => []);
33
37
  if (this.group) {
34
- Rx.merge(...commands.map(c => c.close))
35
- .subscribe(command => {
38
+ Rx.merge(...commands.map(c => c.close)).subscribe(command => {
36
39
  if (command.index !== this.activeCommandIndex) {
37
40
  return;
38
41
  }
@@ -66,4 +69,3 @@ class OutputWriter {
66
69
  }
67
70
  }
68
71
  exports.OutputWriter = OutputWriter;
69
- ;
package/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  // While in local development, make sure you've run `npm run build` first.
3
3
  //
4
4
 
5
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
5
6
  const concurrently = require('./dist/src/index.js');
6
7
  module.exports = exports = concurrently.default;
7
8
  Object.assign(exports, concurrently);