concurrently 7.0.0 → 7.1.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
@@ -1,6 +1,6 @@
1
1
  # Concurrently
2
2
 
3
- [![Build Status](https://github.com/open-cli-tools/concurrently/workflows/Tests/badge.svg)](https://github.com/open-cli-tools/concurrently/actions?workflow=Tests)
3
+ [![Build Status](https://github.com/open-cli-tools/concurrently/workflows/Tests/badge.svg)](https://github.com/open-cli-tools/concurrently/actions?workflow=Tests)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/open-cli-tools/concurrently/badge.svg?branch=master)](https://coveralls.io/github/open-cli-tools/concurrently?branch=master)
5
5
 
6
6
  [![NPM Badge](https://nodei.co/npm/concurrently.png?downloads=true)](https://www.npmjs.com/package/concurrently)
@@ -109,6 +109,26 @@ concurrently -n w: npm:watch-*
109
109
  concurrently -n w:js,w:css,w:node "npm run watch-js" "npm run watch-css" "npm run watch-node"
110
110
  ```
111
111
 
112
+ Exclusion is also supported. Given the following scripts in package.json:
113
+ ```javascript
114
+ {
115
+ // ...
116
+ "scripts": {
117
+ "lint:js": "...",
118
+ "lint:ts": "...",
119
+ "lint:fix:js": "...",
120
+ "lint:fix:ts": "...",
121
+ // ...
122
+ }
123
+ // ...
124
+ }
125
+ ```
126
+ ```bash
127
+ # Running only lint:js and lint:ts
128
+ # with lint:fix:js and lint:fix:ts excluded
129
+ concurrently "npm:lint:*(!fix)"
130
+ ```
131
+
112
132
  Good frontend one-liner example [here](https://github.com/kimmobrunfeldt/dont-copy-paste-this-frontend-template/blob/5cd2bde719654941bdfc0a42c6f1b8e69ae79980/package.json#L9).
113
133
 
114
134
  Help:
@@ -280,7 +300,7 @@ concurrently can be used programmatically by using the API documented below:
280
300
  - `timestampFormat`: a [date-fns format](https://date-fns.org/v2.0.1/docs/format)
281
301
  to use when prefixing with `time`. Default: `yyyy-MM-dd HH:mm:ss.ZZZ`
282
302
 
283
- > **Returns:** an object in the shape `{ commands, result }`.
303
+ > **Returns:** an object in the shape `{ result, commands }`.
284
304
  > - `result`: a `Promise` that resolves if the run was successful (according to `successCondition` option),
285
305
  > or rejects, containing an array of [`CloseEvent`](#CloseEvent), in the order that the commands terminated.
286
306
  > - `commands`: an array of all spawned [`Command`s](#Command).
@@ -289,7 +309,7 @@ Example:
289
309
 
290
310
  ```js
291
311
  const concurrently = require('concurrently');
292
- concurrently([
312
+ const { result } = concurrently([
293
313
  'npm:watch-*',
294
314
  { command: 'nodemon', name: 'server' },
295
315
  { command: 'deploy', name: 'deploy', env: { PUBLIC_KEY: '...' } },
@@ -299,11 +319,12 @@ concurrently([
299
319
  killOthers: ['failure', 'success'],
300
320
  restartTries: 3,
301
321
  cwd: path.resolve(__dirname, 'scripts'),
302
- }).then(success, failure);
322
+ });
323
+ result.then(success, failure);
303
324
  ```
304
325
 
305
326
  ### `Command`
306
- An object that contains all information about a spawned command, and ways to interact with it.
327
+ An object that contains all information about a spawned command, and ways to interact with it.<br>
307
328
  It has the following properties:
308
329
 
309
330
  - `index`: the index of the command among all commands spawned.
@@ -321,11 +342,11 @@ It has the following properties:
321
342
  - `timer`: an RxJS observable to the command's timing events (e.g. starting, stopping).
322
343
  - `close`: an RxJS observable to the command's close events.
323
344
  See [`CloseEvent`](#CloseEvent) for more information.
324
- - `start()`: starts the command, setting up all
345
+ - `start()`: starts the command, setting up all
325
346
  - `kill([signal])`: kills the command, optionally specifying a signal (e.g. `SIGTERM`, `SIGKILL`, etc).
326
347
 
327
348
  ### `CloseEvent`
328
- An object with information about a command's closing event.
349
+ An object with information about a command's closing event.<br>
329
350
  It contains the following properties:
330
351
 
331
352
  - `command`: a stripped down version of [`Command`](#command), including only `name`, `command`, `env` and `cwd` properties.
@@ -52,6 +52,10 @@ const examples = [
52
52
  {
53
53
  description: 'Shortened NPM run command with wildcard (make sure to wrap it in quotes!)',
54
54
  example: '$ $0 "npm:watch-*"',
55
+ },
56
+ {
57
+ description: 'Exclude patterns so that between "lint:js" and "lint:fix:js", only "lint:js" is ran',
58
+ example: '$ $0 "npm:*(!fix)"'
55
59
  }
56
60
  ];
57
61
  exports.epilogue = `
@@ -22,6 +22,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.ExpandNpmWildcard = void 0;
23
23
  const fs = __importStar(require("fs"));
24
24
  const _ = __importStar(require("lodash"));
25
+ const OMISSION = /\(!([^\)]+)\)/;
25
26
  /**
26
27
  * Finds wildcards in npm/yarn/pnpm run commands and replaces them with all matching scripts in the
27
28
  * `package.json` file of the current directory.
@@ -50,13 +51,21 @@ class ExpandNpmWildcard {
50
51
  if (!this.scripts) {
51
52
  this.scripts = Object.keys(this.readPackage().scripts || {});
52
53
  }
53
- const preWildcard = _.escapeRegExp(cmdName.substr(0, wildcardPosition));
54
- const postWildcard = _.escapeRegExp(cmdName.substr(wildcardPosition + 1));
54
+ const omissionRegex = cmdName.match(OMISSION);
55
+ const cmdNameSansOmission = cmdName.replace(OMISSION, '');
56
+ const preWildcard = _.escapeRegExp(cmdNameSansOmission.substr(0, wildcardPosition));
57
+ const postWildcard = _.escapeRegExp(cmdNameSansOmission.substr(wildcardPosition + 1));
55
58
  const wildcardRegex = new RegExp(`^${preWildcard}(.*?)${postWildcard}$`);
56
59
  const currentName = commandInfo.name || '';
57
60
  return this.scripts
58
61
  .map(script => {
59
62
  const match = script.match(wildcardRegex);
63
+ if (omissionRegex) {
64
+ const toOmit = script.match(new RegExp(omissionRegex[1]));
65
+ if (toOmit) {
66
+ return;
67
+ }
68
+ }
60
69
  if (match) {
61
70
  return Object.assign({}, commandInfo, {
62
71
  command: `${npmCmd} run ${script}${args}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "concurrently",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "description": "Run commands concurrently",
5
5
  "main": "index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -69,7 +69,8 @@
69
69
  "index.js",
70
70
  "index.mjs",
71
71
  "!**/fixtures",
72
- "!**/*.spec.js"
72
+ "!**/*.spec.js",
73
+ "!**/*.spec.d.ts"
73
74
  ],
74
75
  "jest": {
75
76
  "preset": "ts-jest",
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};