concurrently
Advanced tools
Comparing version 6.5.1 to 7.0.0
74
index.js
@@ -1,69 +0,7 @@ | ||
const InputHandler = require('./src/flow-control/input-handler'); | ||
const KillOnSignal = require('./src/flow-control/kill-on-signal'); | ||
const KillOthers = require('./src/flow-control/kill-others'); | ||
const LogError = require('./src/flow-control/log-error'); | ||
const LogExit = require('./src/flow-control/log-exit'); | ||
const LogOutput = require('./src/flow-control/log-output'); | ||
const RestartProcess = require('./src/flow-control/restart-process'); | ||
// | ||
// While in local development, make sure you've run `npm run build` first. | ||
// | ||
const concurrently = require('./src/concurrently'); | ||
const Logger = require('./src/logger'); | ||
const LogTimings = require( './src/flow-control/log-timings' ); | ||
module.exports = exports = (commands, options = {}) => { | ||
const logger = new Logger({ | ||
hide: options.hide, | ||
outputStream: options.outputStream || process.stdout, | ||
prefixFormat: options.prefix, | ||
prefixLength: options.prefixLength, | ||
raw: options.raw, | ||
timestampFormat: options.timestampFormat, | ||
}); | ||
return concurrently(commands, { | ||
maxProcesses: options.maxProcesses, | ||
raw: options.raw, | ||
successCondition: options.successCondition, | ||
cwd: options.cwd, | ||
controllers: [ | ||
new LogError({ logger }), | ||
new LogOutput({ logger }), | ||
new LogExit({ logger }), | ||
new InputHandler({ | ||
logger, | ||
defaultInputTarget: options.defaultInputTarget, | ||
inputStream: options.inputStream || (options.handleInput && process.stdin), | ||
pauseInputStreamOnFinish: options.pauseInputStreamOnFinish, | ||
}), | ||
new KillOnSignal({ process }), | ||
new RestartProcess({ | ||
logger, | ||
delay: options.restartDelay, | ||
tries: options.restartTries, | ||
}), | ||
new KillOthers({ | ||
logger, | ||
conditions: options.killOthers | ||
}), | ||
new LogTimings({ | ||
logger: options.timings ? logger: null, | ||
timestampFormat: options.timestampFormat, | ||
}) | ||
], | ||
prefixColors: options.prefixColors || [], | ||
timings: options.timings | ||
}); | ||
}; | ||
// Export all flow controllers and the main concurrently function, | ||
// so that 3rd-parties can use them however they want | ||
exports.concurrently = concurrently; | ||
exports.Logger = Logger; | ||
exports.InputHandler = InputHandler; | ||
exports.KillOnSignal = KillOnSignal; | ||
exports.KillOthers = KillOthers; | ||
exports.LogError = LogError; | ||
exports.LogExit = LogExit; | ||
exports.LogOutput = LogOutput; | ||
exports.RestartProcess = RestartProcess; | ||
exports.LogTimings = LogTimings; | ||
const concurrently = require('./dist/src/index.js'); | ||
module.exports = exports = concurrently.default; | ||
Object.assign(exports, concurrently); |
{ | ||
"name": "concurrently", | ||
"version": "6.5.1", | ||
"version": "7.0.0", | ||
"description": "Run commands concurrently", | ||
"main": "index.js", | ||
"types": "dist/src/index.d.ts", | ||
"type": "commonjs", | ||
"bin": { | ||
"concurrently": "./bin/concurrently.js" | ||
"concurrently": "./dist/bin/concurrently.js" | ||
}, | ||
"engines": { | ||
"node": ">=10.0.0" | ||
"node": "^12.20.0 || ^14.13.0 || >=16.0.0" | ||
}, | ||
"exports": { | ||
"import": "./index.mjs", | ||
"require": "./index.js", | ||
"default": "./index.js" | ||
}, | ||
"scripts": { | ||
"lint": "eslint . --ignore-path .gitignore", | ||
"build": "tsc --build", | ||
"postbuild": "chmod +x dist/bin/concurrently.js", | ||
"clean": "tsc --build --clean", | ||
"lint": "eslint . --ext js,ts --ignore-path .gitignore", | ||
"prepublishOnly": "npm run build", | ||
"report-coverage": "cat coverage/lcov.info | coveralls", | ||
@@ -42,18 +53,29 @@ "test": "jest" | ||
"devDependencies": { | ||
"@types/jest": "^27.0.3", | ||
"@types/lodash": "^4.14.178", | ||
"@types/node": "^17.0.0", | ||
"@types/supports-color": "^8.1.1", | ||
"@typescript-eslint/eslint-plugin": "^5.8.1", | ||
"@typescript-eslint/parser": "^5.8.1", | ||
"coveralls": "^3.1.0", | ||
"eslint": "^7.17.0", | ||
"jest": "^26.6.3", | ||
"jest-create-mock-instance": "^1.1.0" | ||
"jest-create-mock-instance": "^1.1.0", | ||
"ts-jest": "^26.5.6", | ||
"ts-node": "^10.4.0", | ||
"typescript": "^4.5.4" | ||
}, | ||
"files": [ | ||
"bin", | ||
"dist", | ||
"index.js", | ||
"index.mjs", | ||
"!**/fixtures", | ||
"index.js", | ||
"src", | ||
"!*.spec.js" | ||
"!**/*.spec.js" | ||
], | ||
"jest": { | ||
"preset": "ts-jest", | ||
"collectCoverage": true, | ||
"collectCoverageFrom": [ | ||
"src/**/*.js" | ||
"src/**/*.ts", | ||
"!src/index.ts" | ||
], | ||
@@ -64,4 +86,8 @@ "coveragePathIgnorePatterns": [ | ||
], | ||
"testEnvironment": "node" | ||
"testEnvironment": "node", | ||
"testPathIgnorePatterns": [ | ||
"/node_modules/", | ||
"/dist" | ||
] | ||
} | ||
} |
@@ -18,4 +18,6 @@ # Concurrently | ||
- [Usage](#usage) | ||
- [Programmatic Usage](#programmatic-usage) | ||
- [API](#api) | ||
- [`concurrently(commands[, options])`](#concurrentlycommands-options) | ||
- [`Command`](#command) | ||
- [`CloseEvent`](#closeevent) | ||
- [FAQ](#faq) | ||
@@ -139,2 +141,6 @@ | ||
[string] [default: ""] | ||
-g, --group Order the output as if the commands were run | ||
sequentially. [boolean] | ||
--timings Show timing information for all processes | ||
[boolean] [default: false] | ||
@@ -152,8 +158,8 @@ Prefix styling | ||
- Available colors: black, red, green, yellow, blue, | ||
magenta, cyan, white, gray, or any hex values for | ||
colors, eg #23de43 | ||
magenta, cyan, white, gray | ||
or any hex values for colors, eg #23de43 | ||
- Available background colors: bgBlack, bgRed, | ||
bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite | ||
See https://www.npmjs.com/package/chalk for more | ||
information. [string] [default: "reset"] | ||
information. [string] [default: "reset"] | ||
-l, --prefix-length Limit how many characters of the command is displayed | ||
@@ -167,13 +173,15 @@ in prefix. The option can be used to shorten the | ||
Input handling | ||
-i, --handle-input Whether input should be forwarded to the child | ||
processes. See examples for more information.[boolean] | ||
--default-input-target Identifier for child process to which input on stdin | ||
should be sent if not specified at start of input. | ||
Can be either the index or the name of the process. | ||
[default: 0] | ||
-i, --handle-input Whether input should be forwarded to the child | ||
processes. See examples for more information. | ||
[boolean] | ||
--default-input-target Identifier for child process to which input on | ||
stdin should be sent if not specified at start of | ||
input. | ||
Can be either the index or the name of the | ||
process. [default: 0] | ||
Killing other processes | ||
-k, --kill-others kill other processes if one exits or dies [boolean] | ||
--kill-others-on-fail kill other processes if one exits with non zero status | ||
code [boolean] | ||
-k, --kill-others kill other processes if one exits or dies [boolean] | ||
--kill-others-on-fail kill other processes if one exits with non zero | ||
status code [boolean] | ||
@@ -240,3 +248,3 @@ Restarting | ||
## Programmatic Usage | ||
## API | ||
concurrently can be used programmatically by using the API documented below: | ||
@@ -280,7 +288,6 @@ | ||
> Returns: a `Promise` that resolves if the run was successful (according to `successCondition` option), | ||
> or rejects, containing an array of objects with information for each command that has been run, in the order | ||
> that the commands terminated. The objects have the shape `{ command, index, exitCode, killed }`, where `command` is the object | ||
> passed in the `commands` array, `index` its index there and `killed` indicates if the process was killed as a result of | ||
> `killOthers`. Default values (empty strings or objects) are returned for the fields that were not specified. | ||
> **Returns:** an object in the shape `{ commands, result }`. | ||
> - `result`: a `Promise` that resolves if the run was successful (according to `successCondition` option), | ||
> or rejects, containing an array of [`CloseEvent`](#CloseEvent), in the order that the commands terminated. | ||
> - `commands`: an array of all spawned [`Command`s](#Command). | ||
@@ -304,2 +311,34 @@ Example: | ||
### `Command` | ||
An object that contains all information about a spawned command, and ways to interact with it. | ||
It has the following properties: | ||
- `index`: the index of the command among all commands spawned. | ||
- `command`: the command line of the command. | ||
- `name`: the name of the command; defaults to an empty string. | ||
- `cwd`: the current working directory of the command. | ||
- `env`: an object with all the environment variables that the command will be spawned with. | ||
- `killed`: whether the command has been killed. | ||
- `exited`: whether the command exited yet. | ||
- `pid`: the command's process ID. | ||
- `stdin`: a Writable stream to the command's `stdin`. | ||
- `stdout`: an RxJS observable to the command's `stdout`. | ||
- `stderr`: an RxJS observable to the command's `stderr`. | ||
- `error`: an RxJS observable to the command's error events (e.g. when it fails to spawn). | ||
- `timer`: an RxJS observable to the command's timing events (e.g. starting, stopping). | ||
- `close`: an RxJS observable to the command's close events. | ||
See [`CloseEvent`](#CloseEvent) for more information. | ||
- `start()`: starts the command, setting up all | ||
- `kill([signal])`: kills the command, optionally specifying a signal (e.g. `SIGTERM`, `SIGKILL`, etc). | ||
### `CloseEvent` | ||
An object with information about a command's closing event. | ||
It contains the following properties: | ||
- `command`: a stripped down version of [`Command`](#command), including only `name`, `command`, `env` and `cwd` properties. | ||
- `index`: the index of the command among all commands spawned. | ||
- `killed`: whether the command exited because it was killed. | ||
- `exitCode`: the exit code of the command's process, or the signal which it was killed with. | ||
- `timings`: an object in the shape `{ startDate, endDate, durationSeconds }`. | ||
## FAQ | ||
@@ -306,0 +345,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
69
355
2
100398
13
2140
1