concurrently 5.3.0 → 6.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
@@ -10,11 +10,13 @@ Like `npm run watch-js & npm run watch-less` but better.
10
10
  ![](docs/demo.gif)
11
11
 
12
12
  **Table of contents**
13
- - [Why](#why)
14
- - [Install](#install)
15
- - [Usage](#usage)
16
- - [Programmatic Usage](#programmatic-usage)
17
- - [FAQ](#faq)
13
+ - [Concurrently](#concurrently)
14
+ - [Why](#why)
15
+ - [Install](#install)
16
+ - [Usage](#usage)
17
+ - [Programmatic Usage](#programmatic-usage)
18
+ - [`concurrently(commands[, options])`](#concurrentlycommands-options)
19
+ - [FAQ](#faq)
18
20
 
19
21
  ## Why
20
22
 
@@ -140,7 +142,8 @@ Prefix styling
140
142
  - Available modifiers: reset, bold, dim, italic,
141
143
  underline, inverse, hidden, strikethrough
142
144
  - Available colors: black, red, green, yellow, blue,
143
- magenta, cyan, white, gray
145
+ magenta, cyan, white, gray, or any hex values for
146
+ colors, eg #23de43
144
147
  - Available background colors: bgBlack, bgRed,
145
148
  bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite
146
149
  See https://www.npmjs.com/package/chalk for more
@@ -225,8 +228,10 @@ concurrently can be used programmatically by using the API documented below:
225
228
 
226
229
  ### `concurrently(commands[, options])`
227
230
  - `commands`: an array of either strings (containing the commands to run) or objects
228
- with the shape `{ command, name, prefixColor, env }`.
231
+ with the shape `{ command, name, prefixColor, env, cwd }`.
229
232
  - `options` (optional): an object containing any of the below:
233
+ - `cwd`: the working directory to be used by all commands. Can be overriden per command.
234
+ Default: `process.cwd()`.
230
235
  - `defaultInputTarget`: the default input target when reading from `inputStream`.
231
236
  Default: `0`.
232
237
  - `inputStream`: a [`Readable` stream](https://nodejs.org/dist/latest-v10.x/docs/api/stream.html#stream_readable_streams)
@@ -263,11 +268,13 @@ const concurrently = require('concurrently');
263
268
  concurrently([
264
269
  'npm:watch-*',
265
270
  { command: 'nodemon', name: 'server' },
266
- { command: 'deploy', name: 'deploy', env: { PUBLIC_KEY: '...' } }
271
+ { command: 'deploy', name: 'deploy', env: { PUBLIC_KEY: '...' } },
272
+ { command: 'watch', name: 'watch', cwd: path.resolve(__dirname, 'scripts/watchers')}
267
273
  ], {
268
274
  prefix: 'name',
269
275
  killOthers: ['failure', 'success'],
270
276
  restartTries: 3,
277
+ cwd: path.resolve(__dirname, 'scripts'),
271
278
  }).then(success, failure);
272
279
  ```
273
280
 
@@ -83,7 +83,8 @@ const args = yargs
83
83
  'Comma-separated list of chalk colors to use on prefixes. ' +
84
84
  'If there are more commands than colors, the last color will be repeated.\n' +
85
85
  '- Available modifiers: reset, bold, dim, italic, underline, inverse, hidden, strikethrough\n' +
86
- '- Available colors: black, red, green, yellow, blue, magenta, cyan, white, gray\n' +
86
+ '- Available colors: black, red, green, yellow, blue, magenta, cyan, white, gray \n' +
87
+ 'or any hex values for colors, eg #23de43\n' +
87
88
  '- Available background colors: bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite\n' +
88
89
  'See https://www.npmjs.com/package/chalk for more information.',
89
90
  default: defaults.prefixColors,
package/index.js CHANGED
@@ -22,6 +22,7 @@ module.exports = (commands, options = {}) => {
22
22
  maxProcesses: options.maxProcesses,
23
23
  raw: options.raw,
24
24
  successCondition: options.successCondition,
25
+ cwd: options.cwd,
25
26
  controllers: [
26
27
  new LogError({ logger }),
27
28
  new LogOutput({ logger }),
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "concurrently",
3
- "version": "5.3.0",
3
+ "version": "6.0.0",
4
4
  "description": "Run commands concurrently",
5
5
  "main": "index.js",
6
6
  "bin": {
7
7
  "concurrently": "./bin/concurrently.js"
8
8
  },
9
9
  "engines": {
10
- "node": ">=6.0.0"
10
+ "node": ">=10.0.0"
11
11
  },
12
12
  "scripts": {
13
13
  "lint": "eslint . --ignore-path .gitignore",
@@ -29,20 +29,20 @@
29
29
  "author": "Kimmo Brunfeldt",
30
30
  "license": "MIT",
31
31
  "dependencies": {
32
- "chalk": "^2.4.2",
33
- "date-fns": "^2.0.1",
34
- "lodash": "^4.17.15",
35
- "read-pkg": "^4.0.1",
36
- "rxjs": "^6.5.2",
32
+ "chalk": "^4.1.0",
33
+ "date-fns": "^2.16.1",
34
+ "lodash": "^4.17.20",
35
+ "read-pkg": "^5.2.0",
36
+ "rxjs": "^6.6.3",
37
37
  "spawn-command": "^0.0.2-1",
38
- "supports-color": "^6.1.0",
38
+ "supports-color": "^8.1.0",
39
39
  "tree-kill": "^1.2.2",
40
- "yargs": "^13.3.0"
40
+ "yargs": "^16.2.0"
41
41
  },
42
42
  "devDependencies": {
43
- "coveralls": "^3.0.4",
44
- "eslint": "^5.16.0",
45
- "jest": "^24.8.0",
43
+ "coveralls": "^3.1.0",
44
+ "eslint": "^7.17.0",
45
+ "jest": "^26.6.3",
46
46
  "jest-create-mock-instance": "^1.1.0"
47
47
  },
48
48
  "files": [
@@ -16,7 +16,8 @@ const defaults = {
16
16
  spawn,
17
17
  kill: treeKill,
18
18
  raw: false,
19
- controllers: []
19
+ controllers: [],
20
+ cwd: undefined,
20
21
  };
21
22
 
22
23
  module.exports = (commands, options) => {
@@ -37,7 +38,11 @@ module.exports = (commands, options) => {
37
38
  .map((command, index) => new Command(
38
39
  Object.assign({
39
40
  index,
40
- spawnOpts: getSpawnOpts({ raw: options.raw, env: command.env }),
41
+ spawnOpts: getSpawnOpts({
42
+ raw: options.raw,
43
+ env: command.env,
44
+ cwd: command.cwd || options.cwd,
45
+ }),
41
46
  killProcess: options.kill,
42
47
  spawn: options.spawn,
43
48
  }, command)
package/src/defaults.js CHANGED
@@ -25,5 +25,7 @@ module.exports = {
25
25
  // Condition of success for concurrently itself.
26
26
  success: 'all',
27
27
  // Refer to https://date-fns.org/v2.0.1/docs/format
28
- timestampFormat: 'yyyy-MM-dd HH:mm:ss.SSS'
28
+ timestampFormat: 'yyyy-MM-dd HH:mm:ss.SSS',
29
+ // Current working dir passed as option to spawn command. Default: process.cwd()
30
+ cwd: undefined
29
31
  };
@@ -2,11 +2,14 @@ const supportsColor = require('supports-color');
2
2
 
3
3
  module.exports = ({
4
4
  colorSupport = supportsColor.stdout,
5
+ cwd,
5
6
  process = global.process,
6
7
  raw = false,
7
- env = {}
8
+ env = {},
8
9
  }) => Object.assign(
9
- {},
10
+ {
11
+ cwd: cwd || process.cwd(),
12
+ },
10
13
  raw && { stdio: 'inherit' },
11
14
  /^win/.test(process.platform) && { detached: false },
12
15
  { env: Object.assign(colorSupport ? { FORCE_COLOR: colorSupport.level } : {}, process.env, env) }
package/src/logger.js CHANGED
@@ -57,7 +57,12 @@ module.exports = class Logger {
57
57
  }
58
58
 
59
59
  colorText(command, text) {
60
- const color = _.get(chalk, command.prefixColor, chalk.gray.dim);
60
+ let color;
61
+ if (command.prefixColor && command.prefixColor.startsWith('#')) {
62
+ color = chalk.hex(command.prefixColor);
63
+ } else {
64
+ color = _.get(chalk, command.prefixColor, chalk.gray.dim);
65
+ }
61
66
  return color(text);
62
67
  }
63
68