concurrently 8.1.0 → 8.2.1

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 CHANGED
@@ -376,7 +376,7 @@ const { result } = concurrently(
376
376
  killOthers: ['failure', 'success'],
377
377
  restartTries: 3,
378
378
  cwd: path.resolve(__dirname, 'scripts'),
379
- }
379
+ },
380
380
  );
381
381
  result.then(success, failure);
382
382
  ```
@@ -64,7 +64,9 @@ class Command {
64
64
  this.timer.next({ startDate, endDate });
65
65
  this.error.next(event);
66
66
  });
67
- Rx.fromEvent(child, 'close').subscribe(([exitCode, signal]) => {
67
+ Rx.fromEvent(child, 'close')
68
+ .pipe(Rx.map((event) => event))
69
+ .subscribe(([exitCode, signal]) => {
68
70
  this.process = undefined;
69
71
  this.exited = true;
70
72
  const endDate = new Date(Date.now());
@@ -82,8 +84,10 @@ class Command {
82
84
  },
83
85
  });
84
86
  });
85
- child.stdout && pipeTo(Rx.fromEvent(child.stdout, 'data'), this.stdout);
86
- child.stderr && pipeTo(Rx.fromEvent(child.stderr, 'data'), this.stderr);
87
+ child.stdout &&
88
+ pipeTo(Rx.fromEvent(child.stdout, 'data').pipe(Rx.map((event) => event)), this.stdout);
89
+ child.stderr &&
90
+ pipeTo(Rx.fromEvent(child.stderr, 'data').pipe(Rx.map((event) => event)), this.stderr);
87
91
  this.stdin = child.stdin || undefined;
88
92
  }
89
93
  /**
@@ -68,7 +68,7 @@ class CompletionListener {
68
68
  const closeStreams = commands.map((command) => command.close);
69
69
  return Rx.lastValueFrom(Rx.merge(...closeStreams).pipe((0, operators_1.bufferCount)(closeStreams.length), (0, operators_1.switchMap)((exitInfos) => this.isSuccess(exitInfos)
70
70
  ? this.emitWithScheduler(Rx.of(exitInfos))
71
- : this.emitWithScheduler(Rx.throwError(exitInfos))), (0, operators_1.take)(1)));
71
+ : this.emitWithScheduler(Rx.throwError(() => exitInfos))), (0, operators_1.take)(1)));
72
72
  }
73
73
  emitWithScheduler(input) {
74
74
  return this.scheduler ? input.pipe(Rx.observeOn(this.scheduler)) : input;
@@ -48,19 +48,32 @@ class InputHandler {
48
48
  if (!inputStream) {
49
49
  return { commands };
50
50
  }
51
+ const commandsMap = new Map();
52
+ for (const command of commands) {
53
+ commandsMap.set(command.index.toString(), command);
54
+ commandsMap.set(command.name, command);
55
+ }
51
56
  Rx.fromEvent(inputStream, 'data')
52
57
  .pipe((0, operators_1.map)((data) => String(data)))
53
58
  .subscribe((data) => {
54
- const dataParts = data.split(/:(.+)/);
55
- const targetId = dataParts.length > 1 ? dataParts[0] : this.defaultInputTarget;
56
- const input = dataParts[1] || data;
57
- const command = commands.find((command) => command.name === targetId ||
58
- command.index.toString() === targetId.toString());
59
+ let command, input;
60
+ const dataParts = data.split(/:(.+)/s);
61
+ let target = dataParts[0];
62
+ if (dataParts.length > 1 && (command = commandsMap.get(target))) {
63
+ input = dataParts[1];
64
+ }
65
+ else {
66
+ // If `target` does not match a registered command,
67
+ // fallback to `defaultInputTarget` and forward the whole input data
68
+ target = this.defaultInputTarget.toString();
69
+ command = commandsMap.get(target);
70
+ input = data;
71
+ }
59
72
  if (command && command.stdin) {
60
73
  command.stdin.write(input);
61
74
  }
62
75
  else {
63
- this.logger.logGlobalEvent(`Unable to find command ${targetId}, or it has no stdin open\n`);
76
+ this.logger.logGlobalEvent(`Unable to find command "${target}", or it has no stdin open\n`);
64
77
  }
65
78
  });
66
79
  return {
@@ -22,6 +22,10 @@ export declare class LogTimings implements FlowController {
22
22
  private printExitInfoTimingTable;
23
23
  handle(commands: Command[]): {
24
24
  commands: Command[];
25
+ onFinish?: undefined;
26
+ } | {
27
+ commands: Command[];
28
+ onFinish: () => void;
25
29
  };
26
30
  }
27
31
  export {};
@@ -83,9 +83,10 @@ class LogTimings {
83
83
  });
84
84
  // overall summary timings
85
85
  const closeStreams = commands.map((command) => command.close);
86
- const allProcessesClosed = Rx.merge(...closeStreams).pipe((0, operators_1.bufferCount)(closeStreams.length), (0, operators_1.take)(1));
87
- allProcessesClosed.subscribe((exitInfos) => this.printExitInfoTimingTable(exitInfos));
88
- return { commands };
86
+ const finished = new Rx.Subject();
87
+ const allProcessesClosed = Rx.merge(...closeStreams).pipe((0, operators_1.bufferCount)(closeStreams.length), (0, operators_1.take)(1), (0, operators_1.combineLatestWith)(finished));
88
+ allProcessesClosed.subscribe(([exitInfos]) => this.printExitInfoTimingTable(exitInfos));
89
+ return { commands, onFinish: () => finished.next() };
89
90
  }
90
91
  }
91
92
  exports.LogTimings = LogTimings;
@@ -47,11 +47,11 @@ class RestartProcess {
47
47
  .map((failure, index) => Rx.merge(
48
48
  // Delay the emission (so that the restarts happen on time),
49
49
  // explicitly telling the subscriber that a restart is needed
50
- failure.pipe((0, operators_1.delay)(this.delay, this.scheduler), (0, operators_1.mapTo)(true)),
50
+ failure.pipe((0, operators_1.delay)(this.delay, this.scheduler), (0, operators_1.map)(() => true)),
51
51
  // Skip the first N emissions (as these would be duplicates of the above),
52
52
  // meaning it will be empty because of success, or failed all N times,
53
53
  // and no more restarts should be attempted.
54
- failure.pipe((0, operators_1.skip)(this.tries), (0, operators_1.mapTo)(false), (0, operators_1.defaultIfEmpty)(false))).subscribe((restart) => {
54
+ failure.pipe((0, operators_1.skip)(this.tries), (0, operators_1.map)(() => false), (0, operators_1.defaultIfEmpty)(false))).subscribe((restart) => {
55
55
  const command = commands[index];
56
56
  if (restart) {
57
57
  this.logger.logCommandEvent(`${command.command} restarted`, command);
@@ -16,7 +16,7 @@ export declare const getSpawnOpts: ({ colorSupport, cwd, process, raw, env, }: {
16
16
  /**
17
17
  * The NodeJS process.
18
18
  */
19
- process?: Pick<NodeJS.Process, "cwd" | "env" | "platform"> | undefined;
19
+ process?: Pick<NodeJS.Process, "platform" | "cwd" | "env"> | undefined;
20
20
  /**
21
21
  * A custom working directory to spawn processes in.
22
22
  * Defaults to `process.cwd()`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "concurrently",
3
- "version": "8.1.0",
3
+ "version": "8.2.1",
4
4
  "description": "Run commands concurrently",
5
5
  "main": "index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -38,44 +38,44 @@
38
38
  "license": "MIT",
39
39
  "dependencies": {
40
40
  "chalk": "^4.1.2",
41
- "date-fns": "^2.29.3",
41
+ "date-fns": "^2.30.0",
42
42
  "lodash": "^4.17.21",
43
- "rxjs": "^7.8.0",
44
- "shell-quote": "^1.8.0",
45
- "spawn-command": "0.0.2-1",
43
+ "rxjs": "^7.8.1",
44
+ "shell-quote": "^1.8.1",
45
+ "spawn-command": "0.0.2",
46
46
  "supports-color": "^8.1.1",
47
47
  "tree-kill": "^1.2.2",
48
- "yargs": "^17.7.1"
48
+ "yargs": "^17.7.2"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@hirez_io/observer-spy": "^2.2.0",
52
- "@swc/core": "^1.3.42",
53
- "@swc/jest": "^0.2.24",
54
- "@types/jest": "^29.5.0",
55
- "@types/lodash": "^4.14.192",
56
- "@types/node": "^14.18.42",
52
+ "@swc/core": "^1.3.78",
53
+ "@swc/jest": "^0.2.29",
54
+ "@types/jest": "^29.5.3",
55
+ "@types/lodash": "^4.14.197",
56
+ "@types/node": "^14.18.54",
57
57
  "@types/shell-quote": "^1.7.1",
58
58
  "@types/supports-color": "^8.1.1",
59
59
  "@types/yargs": "^17.0.24",
60
- "@typescript-eslint/eslint-plugin": "^5.57.0",
61
- "@typescript-eslint/parser": "^5.57.0",
60
+ "@typescript-eslint/eslint-plugin": "^6.4.1",
61
+ "@typescript-eslint/parser": "^6.4.1",
62
62
  "coveralls-next": "^4.2.0",
63
63
  "ctrlc-wrapper": "^0.0.4",
64
- "esbuild": "~0.17.14",
65
- "eslint": "^8.37.0",
66
- "eslint-config-prettier": "^8.8.0",
67
- "eslint-plugin-import": "^2.27.5",
68
- "eslint-plugin-jest": "^27.2.1",
69
- "eslint-plugin-prettier": "^4.2.1",
64
+ "esbuild": "~0.19.2",
65
+ "eslint": "^8.47.0",
66
+ "eslint-config-prettier": "^9.0.0",
67
+ "eslint-plugin-import": "^2.28.1",
68
+ "eslint-plugin-jest": "^27.2.3",
69
+ "eslint-plugin-prettier": "^5.0.0",
70
70
  "eslint-plugin-simple-import-sort": "^10.0.0",
71
71
  "husky": "^8.0.3",
72
- "jest": "^29.5.0",
72
+ "jest": "^29.6.3",
73
73
  "jest-create-mock-instance": "^2.0.0",
74
- "lint-staged": "^13.2.0",
75
- "prettier": "^2.8.7",
74
+ "lint-staged": "^13.3.0",
75
+ "prettier": "^3.0.2",
76
76
  "safe-publish-latest": "^2.0.0",
77
- "string-argv": "^0.3.1",
78
- "typescript": "~5.0.2"
77
+ "string-argv": "^0.3.2",
78
+ "typescript": "~5.1.6"
79
79
  },
80
80
  "files": [
81
81
  "dist",