concurrently 7.6.0 → 8.0.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 CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Latest Release](https://img.shields.io/github/v/release/open-cli-tools/concurrently?label=Release)](https://github.com/open-cli-tools/concurrently/releases)
4
4
  [![License](https://img.shields.io/github/license/open-cli-tools/concurrently?label=License)](https://github.com/open-cli-tools/concurrently/blob/main/LICENSE)
5
5
  [![Weekly Downloads on NPM](https://img.shields.io/npm/dw/concurrently?label=Downloads&logo=npm)](https://www.npmjs.com/package/concurrently)
6
- [![CI Status](https://img.shields.io/github/workflow/status/open-cli-tools/concurrently/Test?label=CI&logo=github)](https://github.com/open-cli-tools/concurrently/actions/workflows/test.yml)
6
+ [![CI Status](https://img.shields.io/github/actions/workflow/status/open-cli-tools/concurrently/test.yml?label=CI&logo=github)](https://github.com/open-cli-tools/concurrently/actions/workflows/test.yml)
7
7
  [![Coverage Status](https://img.shields.io/coveralls/github/open-cli-tools/concurrently/main?label=Coverage&logo=coveralls)](https://coveralls.io/github/open-cli-tools/concurrently?branch=main)
8
8
 
9
9
  Run multiple commands concurrently.
@@ -25,7 +25,7 @@ Like `npm run watch-js & npm run watch-less` but better.
25
25
 
26
26
  ## Why
27
27
 
28
- I like [task automation with npm](https://github.com/substack/blog/blob/master/npm_run.markdown)
28
+ I like [task automation with npm](https://web.archive.org/web/20220531064025/https://github.com/substack/blog/blob/master/npm_run.markdown)
29
29
  but the usual way to run multiple commands concurrently is
30
30
  `npm run watch-js & npm run watch-css`. That's fine but it's hard to keep
31
31
  on track of different outputs. Also if one process fails, others still keep running
@@ -45,12 +45,12 @@ tired of opening terminals and made **concurrently**.
45
45
 
46
46
  **concurrently** can be installed in the global scope (if you'd like to have it available and use it on the whole system) or locally for a specific package (for example if you'd like to use it in the `scripts` section of your package):
47
47
 
48
- | | npm | Yarn | pnpm |
49
- | ----------- | ----------------------- | ------------------------------ | -------------------------- |
50
- | **Global** | `npm i -g concurrently` | `yarn global add concurrently` | `pnpm add -g concurrently` |
51
- | **Local**\* | `npm i concurrently -D` | `yarn add concurrently -D` | `pnpm add -D concurrently` |
48
+ | | npm | Yarn | pnpm | Bun |
49
+ | ----------- | ----------------------- | ------------------------------ | -------------------------- | ------------------------- |
50
+ | **Global** | `npm i -g concurrently` | `yarn global add concurrently` | `pnpm add -g concurrently` | `bun add -g concurrently` |
51
+ | **Local**\* | `npm i -D concurrently` | `yarn add -D concurrently` | `pnpm add -D concurrently` | `bun add -d concurrently` |
52
52
 
53
- <sub>\* It's recommended to add **concurrently** as `devDependencies` as it's usually used for developing purposes. Please change this flag if this doesn't apply in your case.</sub>
53
+ <sub>\* It's recommended to add **concurrently** to `devDependencies` as it's usually used for developing purposes. Please adjust the command if this doesn't apply in your case.</sub>
54
54
 
55
55
  ## Usage
56
56
 
@@ -219,6 +219,8 @@ Killing other processes
219
219
  -k, --kill-others Kill other processes if one exits or dies.[boolean]
220
220
  --kill-others-on-fail Kill other processes if one exits with non zero
221
221
  status code. [boolean]
222
+ --kill-signal Signal to send to other processes if one exits or dies.
223
+ (SIGTERM/SIGKILL, defaults to SIGTERM) [string]
222
224
 
223
225
  Restarting
224
226
  --restart-tries How many times a process that died should restart.
@@ -427,6 +429,6 @@ It contains the following properties:
427
429
  So _null_ means the process didn't terminate normally. This will make **concurrently**
428
430
  to return non-zero exit code too.
429
431
 
430
- - Does this work with the npm-replacements [yarn](https://github.com/yarnpkg/yarn) or [pnpm](https://pnpm.js.org/)?
432
+ - Does this work with the npm-replacements [yarn](https://github.com/yarnpkg/yarn), [pnpm](https://pnpm.js.org/), or [Bun](https://bun.sh/)?
431
433
 
432
- Yes! In all examples above, you may replace "`npm`" with "`yarn`" or "`pnpm`".
434
+ Yes! In all examples above, you may replace "`npm`" with "`yarn`", "`pnpm`", or "`bun`".
@@ -127,6 +127,12 @@ const args = (0, yargs_1.default)(argsBeforeSep)
127
127
  describe: 'Kill other processes if one exits with non zero status code.',
128
128
  type: 'boolean',
129
129
  },
130
+ 'kill-signal': {
131
+ alias: 'ks',
132
+ describe: 'Signal to send to other processes if one exits or dies. (SIGTERM/SIGKILL, defaults to SIGTERM)',
133
+ type: 'string',
134
+ default: defaults.killSignal,
135
+ },
130
136
  // Prefix
131
137
  prefix: {
132
138
  alias: 'p',
@@ -190,7 +196,7 @@ const args = (0, yargs_1.default)(argsBeforeSep)
190
196
  .group(['m', 'n', 'name-separator', 's', 'r', 'no-color', 'hide', 'g', 'timings', 'P'], 'General')
191
197
  .group(['p', 'c', 'l', 't'], 'Prefix styling')
192
198
  .group(['i', 'default-input-target'], 'Input handling')
193
- .group(['k', 'kill-others-on-fail'], 'Killing other processes')
199
+ .group(['k', 'kill-others-on-fail', 'kill-signal'], 'Killing other processes')
194
200
  .group(['restart-tries', 'restart-after'], 'Restarting')
195
201
  .epilogue(epilogue_1.epilogue)
196
202
  .parseSync();
@@ -209,6 +215,7 @@ const commands = args.passthroughArguments ? args._ : [...args._, ...argsAfterSe
209
215
  : args.killOthersOnFail
210
216
  ? ['failure']
211
217
  : [],
218
+ killSignal: args.killSignal,
212
219
  maxProcesses: args.maxProcesses,
213
220
  raw: args.raw,
214
221
  hide: args.hide.split(','),
@@ -1,7 +1,7 @@
1
1
  import { CommandInfo } from '../command';
2
2
  import { CommandParser } from './command-parser';
3
3
  /**
4
- * Expands commands prefixed with `npm:`, `yarn:` or `pnpm:` into the full version `npm run <command>` and so on.
4
+ * Expands commands prefixed with `npm:`, `yarn:`, `pnpm:`, or `bun:` into the full version `npm run <command>` and so on.
5
5
  */
6
6
  export declare class ExpandNpmShortcut implements CommandParser {
7
7
  parse(commandInfo: CommandInfo): CommandInfo;
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ExpandNpmShortcut = void 0;
4
4
  /**
5
- * Expands commands prefixed with `npm:`, `yarn:` or `pnpm:` into the full version `npm run <command>` and so on.
5
+ * Expands commands prefixed with `npm:`, `yarn:`, `pnpm:`, or `bun:` into the full version `npm run <command>` and so on.
6
6
  */
7
7
  class ExpandNpmShortcut {
8
8
  parse(commandInfo) {
9
- const [, npmCmd, cmdName, args] = commandInfo.command.match(/^(npm|yarn|pnpm):(\S+)(.*)/) || [];
9
+ const [, npmCmd, cmdName, args] = commandInfo.command.match(/^(npm|yarn|pnpm|bun):(\S+)(.*)/) || [];
10
10
  if (!cmdName) {
11
11
  return commandInfo;
12
12
  }
@@ -1,7 +1,7 @@
1
1
  import { CommandInfo } from '../command';
2
2
  import { CommandParser } from './command-parser';
3
3
  /**
4
- * Finds wildcards in npm/yarn/pnpm run commands and replaces them with all matching scripts in the
4
+ * Finds wildcards in npm/yarn/pnpm/bun run commands and replaces them with all matching scripts in the
5
5
  * `package.json` file of the current directory.
6
6
  */
7
7
  export declare class ExpandNpmWildcard implements CommandParser {
@@ -8,7 +8,7 @@ const fs_1 = __importDefault(require("fs"));
8
8
  const lodash_1 = __importDefault(require("lodash"));
9
9
  const OMISSION = /\(!([^)]+)\)/;
10
10
  /**
11
- * Finds wildcards in npm/yarn/pnpm run commands and replaces them with all matching scripts in the
11
+ * Finds wildcards in npm/yarn/pnpm/bun run commands and replaces them with all matching scripts in the
12
12
  * `package.json` file of the current directory.
13
13
  */
14
14
  class ExpandNpmWildcard {
@@ -25,7 +25,7 @@ class ExpandNpmWildcard {
25
25
  this.readPackage = readPackage;
26
26
  }
27
27
  parse(commandInfo) {
28
- const [, npmCmd, cmdName, args] = commandInfo.command.match(/(npm|yarn|pnpm) run (\S+)([^&]*)/) || [];
28
+ const [, npmCmd, cmdName, args] = commandInfo.command.match(/(npm|yarn|pnpm|bun) run (\S+)([^&]*)/) || [];
29
29
  const wildcardPosition = (cmdName || '').indexOf('*');
30
30
  // If the regex didn't match an npm script, or it has no wildcard,
31
31
  // then we have nothing to do here
@@ -73,7 +73,7 @@ class Command {
73
73
  this.close.next({
74
74
  command: this,
75
75
  index: this.index,
76
- exitCode: exitCode !== null && exitCode !== void 0 ? exitCode : String(signal),
76
+ exitCode: exitCode ?? String(signal),
77
77
  killed: this.killed,
78
78
  timings: {
79
79
  startDate,
@@ -76,6 +76,10 @@ export type ConcurrentlyOptions = {
76
76
  * Defaults to the `tree-kill` module.
77
77
  */
78
78
  kill: KillProcess;
79
+ /**
80
+ * Signal to send to killed processes.
81
+ */
82
+ killSignal?: string;
79
83
  /**
80
84
  * List of additional arguments passed that will get replaced in each command.
81
85
  * If not defined, no argument replacing will happen.
@@ -60,3 +60,9 @@ export declare const timings = false;
60
60
  * Passthrough additional arguments to commands (accessible via placeholders) instead of treating them as commands.
61
61
  */
62
62
  export declare const passthroughArguments = false;
63
+ /**
64
+ * Signal to send to other processes if one exits or dies.
65
+ *
66
+ * Defaults to OS specific signal. (SIGTERM on Linux/MacOS)
67
+ */
68
+ export declare const killSignal: string | undefined;
@@ -3,7 +3,7 @@
3
3
  // It's read by the flow controllers, the executable, etc.
4
4
  // Refer to tests for the meaning of the different possible values.
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.passthroughArguments = exports.timings = exports.cwd = exports.timestampFormat = exports.success = exports.restartDelay = exports.restartTries = exports.raw = exports.prefixLength = exports.prefixColors = exports.prefix = exports.nameSeparator = exports.hide = exports.maxProcesses = exports.handleInput = exports.defaultInputTarget = void 0;
6
+ exports.killSignal = exports.passthroughArguments = exports.timings = exports.cwd = exports.timestampFormat = exports.success = exports.restartDelay = exports.restartTries = exports.raw = exports.prefixLength = exports.prefixColors = exports.prefix = exports.nameSeparator = exports.hide = exports.maxProcesses = exports.handleInput = exports.defaultInputTarget = void 0;
7
7
  exports.defaultInputTarget = 0;
8
8
  /**
9
9
  * Whether process.stdin should be forwarded to child processes.
@@ -65,3 +65,9 @@ exports.timings = false;
65
65
  * Passthrough additional arguments to commands (accessible via placeholders) instead of treating them as commands.
66
66
  */
67
67
  exports.passthroughArguments = false;
68
+ /**
69
+ * Signal to send to other processes if one exits or dies.
70
+ *
71
+ * Defaults to OS specific signal. (SIGTERM on Linux/MacOS)
72
+ */
73
+ exports.killSignal = undefined;
@@ -8,9 +8,11 @@ export 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
+ private readonly killSignal;
12
+ constructor({ logger, conditions, killSignal, }: {
12
13
  logger: Logger;
13
14
  conditions: ProcessCloseCondition | ProcessCloseCondition[];
15
+ killSignal: string | undefined;
14
16
  });
15
17
  handle(commands: Command[]): {
16
18
  commands: Command[];
@@ -11,9 +11,10 @@ const command_1 = require("../command");
11
11
  * Sends a SIGTERM signal to all commands when one of the commands exits with a matching condition.
12
12
  */
13
13
  class KillOthers {
14
- constructor({ logger, conditions, }) {
14
+ constructor({ logger, conditions, killSignal, }) {
15
15
  this.logger = logger;
16
16
  this.conditions = lodash_1.default.castArray(conditions);
17
+ this.killSignal = killSignal;
17
18
  }
18
19
  handle(commands) {
19
20
  const conditions = this.conditions.filter((condition) => condition === 'failure' || condition === 'success');
@@ -24,8 +25,8 @@ class KillOthers {
24
25
  closeStates.forEach((closeState) => closeState.subscribe(() => {
25
26
  const killableCommands = commands.filter((command) => command_1.Command.canKill(command));
26
27
  if (killableCommands.length) {
27
- this.logger.logGlobalEvent('Sending SIGTERM to other processes..');
28
- killableCommands.forEach((command) => command.kill());
28
+ this.logger.logGlobalEvent(`Sending ${this.killSignal || 'SIGTERM'} to other processes..`);
29
+ killableCommands.forEach((command) => command.kill(this.killSignal));
29
30
  }
30
31
  }));
31
32
  return { commands };
@@ -2,6 +2,7 @@
2
2
  /// <reference types="node" />
3
3
  /// <reference types="node" />
4
4
  /// <reference types="node" />
5
+ /// <reference types="node" />
5
6
  import { SpawnOptions } from 'child_process';
6
7
  import supportsColor from 'supports-color';
7
8
  export declare const getSpawnOpts: ({ colorSupport, cwd, process, raw, env, }: {
package/dist/src/index.js CHANGED
@@ -58,6 +58,7 @@ exports.default = (commands, options = {}) => {
58
58
  new kill_others_1.KillOthers({
59
59
  logger,
60
60
  conditions: options.killOthers || [],
61
+ killSignal: options.killSignal,
61
62
  }),
62
63
  new log_timings_1.LogTimings({
63
64
  logger: options.timings ? logger : undefined,
@@ -86,14 +86,13 @@ class Logger {
86
86
  }, prefix);
87
87
  }
88
88
  colorText(command, text) {
89
- var _a;
90
89
  let color;
91
90
  if (command.prefixColor && command.prefixColor.startsWith('#')) {
92
91
  color = chalk_1.default.hex(command.prefixColor);
93
92
  }
94
93
  else {
95
94
  const defaultColor = lodash_1.default.get(chalk_1.default, defaults.prefixColors, chalk_1.default.reset);
96
- color = lodash_1.default.get(chalk_1.default, (_a = command.prefixColor) !== null && _a !== void 0 ? _a : '', defaultColor);
95
+ color = lodash_1.default.get(chalk_1.default, command.prefixColor ?? '', defaultColor);
97
96
  }
98
97
  return color(text);
99
98
  }
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * While in local development, make sure you've run `npm run build` first.
2
+ * While in local development, make sure you've run `pnpm run build` first.
3
3
  */
4
4
 
5
5
  // eslint-disable-next-line @typescript-eslint/no-var-requires
package/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * While in local development, make sure you've run `npm run build` first.
2
+ * While in local development, make sure you've run `pnpm run build` first.
3
3
  */
4
4
 
5
5
  import concurrently from './dist/src/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "concurrently",
3
- "version": "7.6.0",
3
+ "version": "8.0.0",
4
4
  "description": "Run commands concurrently",
5
5
  "main": "index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -10,7 +10,7 @@
10
10
  "conc": "./dist/bin/concurrently.js"
11
11
  },
12
12
  "engines": {
13
- "node": "^12.20.0 || ^14.13.0 || >=16.0.0"
13
+ "node": "^14.13.0 || >=16.0.0"
14
14
  },
15
15
  "exports": {
16
16
  ".": {
@@ -21,18 +21,6 @@
21
21
  },
22
22
  "./package.json": "./package.json"
23
23
  },
24
- "scripts": {
25
- "build": "tsc --build",
26
- "postbuild": "chmod +x dist/bin/concurrently.js",
27
- "clean": "tsc --build --clean",
28
- "format": "prettier --check '**/*.{json,y?(a)ml,md}'",
29
- "format:fix": "npm run format -- --write",
30
- "lint": "eslint --ignore-path .gitignore --ext mjs,js,ts .",
31
- "lint:fix": "npm run lint -- --fix",
32
- "prepublishOnly": "npm run build",
33
- "report-coverage": "cat coverage/lcov.info | coveralls",
34
- "test": "jest"
35
- },
36
24
  "repository": {
37
25
  "type": "git",
38
26
  "url": "https://github.com/open-cli-tools/concurrently.git"
@@ -49,44 +37,45 @@
49
37
  "author": "Kimmo Brunfeldt",
50
38
  "license": "MIT",
51
39
  "dependencies": {
52
- "chalk": "^4.1.0",
53
- "date-fns": "^2.29.1",
40
+ "chalk": "^4.1.2",
41
+ "date-fns": "^2.29.3",
54
42
  "lodash": "^4.17.21",
55
- "rxjs": "^7.0.0",
56
- "shell-quote": "^1.7.3",
57
- "spawn-command": "^0.0.2-1",
58
- "supports-color": "^8.1.0",
43
+ "rxjs": "^7.8.0",
44
+ "shell-quote": "^1.7.4",
45
+ "spawn-command": "0.0.2-1",
46
+ "supports-color": "^8.1.1",
59
47
  "tree-kill": "^1.2.2",
60
- "yargs": "^17.3.1"
48
+ "yargs": "^17.6.2"
61
49
  },
62
50
  "devDependencies": {
63
51
  "@hirez_io/observer-spy": "^2.2.0",
64
- "@swc/core": "^1.2.224",
65
- "@swc/jest": "^0.2.21",
66
- "@types/jest": "^28.1.8",
67
- "@types/lodash": "^4.14.178",
68
- "@types/node": "^16.11.47",
52
+ "@swc/core": "^1.3.24",
53
+ "@swc/jest": "^0.2.24",
54
+ "@types/jest": "^29.2.5",
55
+ "@types/lodash": "^4.14.191",
56
+ "@types/node": "^14.18.36",
69
57
  "@types/shell-quote": "^1.7.1",
70
58
  "@types/supports-color": "^8.1.1",
71
- "@types/yargs": "^17.0.11",
72
- "@typescript-eslint/eslint-plugin": "^5.33.0",
73
- "@typescript-eslint/parser": "^5.33.0",
74
- "coveralls-next": "^4.1.2",
59
+ "@types/yargs": "^17.0.18",
60
+ "@typescript-eslint/eslint-plugin": "^5.48.0",
61
+ "@typescript-eslint/parser": "^5.48.0",
62
+ "coveralls-next": "^4.2.0",
75
63
  "ctrlc-wrapper": "^0.0.4",
76
- "esbuild": "^0.15.1",
77
- "eslint": "^8.21.0",
78
- "eslint-config-prettier": "^8.5.0",
64
+ "esbuild": "^0.16.13",
65
+ "eslint": "^8.31.0",
66
+ "eslint-config-prettier": "^8.6.0",
79
67
  "eslint-plugin-import": "^2.26.0",
80
- "eslint-plugin-jest": "^27.0.4",
81
- "eslint-plugin-prettier": "^4.0.0",
68
+ "eslint-plugin-jest": "^27.2.0",
69
+ "eslint-plugin-prettier": "^4.2.1",
82
70
  "eslint-plugin-simple-import-sort": "^8.0.0",
83
- "jest": "^28.1.3",
71
+ "husky": "^8.0.3",
72
+ "jest": "^29.3.1",
84
73
  "jest-create-mock-instance": "^2.0.0",
85
- "lint-staged": "^12.4.1",
86
- "prettier": "^2.6.2",
87
- "simple-git-hooks": "^2.7.0",
74
+ "lint-staged": "^13.1.0",
75
+ "prettier": "^2.8.1",
76
+ "safe-publish-latest": "^2.0.0",
88
77
  "string-argv": "^0.3.1",
89
- "typescript": "~4.9.3"
78
+ "typescript": "~4.9.4"
90
79
  },
91
80
  "files": [
92
81
  "dist",
@@ -96,11 +85,19 @@
96
85
  "!**/*.spec.js",
97
86
  "!**/*.spec.d.ts"
98
87
  ],
99
- "simple-git-hooks": {
100
- "pre-commit": "npx lint-staged"
101
- },
102
88
  "lint-staged": {
103
- "*.m?{js,ts}": "eslint --fix",
89
+ "*.?(m){js,ts}": "eslint --fix",
104
90
  "*.{json,y?(a)ml,md}": "prettier --write"
91
+ },
92
+ "scripts": {
93
+ "build": "tsc --build",
94
+ "postbuild": "chmod +x dist/bin/concurrently.js",
95
+ "clean": "tsc --build --clean",
96
+ "format": "prettier --check '**/*.{json,y?(a)ml,md}'",
97
+ "format:fix": "pnpm run format --write",
98
+ "lint": "eslint --ignore-path .gitignore --ext mjs,js,ts .",
99
+ "lint:fix": "pnpm run lint --fix",
100
+ "report-coverage": "cat coverage/lcov.info | coveralls",
101
+ "test": "jest"
105
102
  }
106
- }
103
+ }