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 +28 -7
- package/dist/bin/epilogue.js +4 -0
- package/dist/src/command-parser/expand-npm-wildcard.js +11 -2
- package/package.json +3 -2
- package/dist/bin/concurrently.spec.d.ts +0 -1
- package/dist/src/command-parser/expand-npm-shortcut.spec.d.ts +0 -1
- package/dist/src/command-parser/expand-npm-wildcard.spec.d.ts +0 -1
- package/dist/src/command-parser/strip-quotes.spec.d.ts +0 -1
- package/dist/src/command.spec.d.ts +0 -1
- package/dist/src/completion-listener.spec.d.ts +0 -1
- package/dist/src/concurrently.spec.d.ts +0 -1
- package/dist/src/flow-control/input-handler.spec.d.ts +0 -1
- package/dist/src/flow-control/kill-on-signal.spec.d.ts +0 -1
- package/dist/src/flow-control/kill-others.spec.d.ts +0 -1
- package/dist/src/flow-control/log-error.spec.d.ts +0 -1
- package/dist/src/flow-control/log-exit.spec.d.ts +0 -1
- package/dist/src/flow-control/log-output.spec.d.ts +0 -1
- package/dist/src/flow-control/log-timings.spec.d.ts +0 -1
- package/dist/src/flow-control/restart-process.spec.d.ts +0 -1
- package/dist/src/get-spawn-opts.spec.d.ts +0 -1
- package/dist/src/logger.spec.d.ts +0 -1
- package/dist/src/output-writer.spec.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Concurrently
|
|
2
2
|
|
|
3
|
-
[](https://github.com/open-cli-tools/concurrently/actions?workflow=Tests)
|
|
3
|
+
[](https://github.com/open-cli-tools/concurrently/actions?workflow=Tests)
|
|
4
4
|
[](https://coveralls.io/github/open-cli-tools/concurrently?branch=master)
|
|
5
5
|
|
|
6
6
|
[](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 `{
|
|
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
|
-
})
|
|
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.
|
package/dist/bin/epilogue.js
CHANGED
|
@@ -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
|
|
54
|
-
const
|
|
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.
|
|
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 {};
|