Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lerna/child-process

Package Overview
Dependencies
Maintainers
2
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lerna/child-process - npm Package Compare versions

Comparing version 3.16.5 to 4.0.0

27

CHANGELOG.md

@@ -6,2 +6,29 @@ # Change Log

# [4.0.0](https://github.com/lerna/lerna/compare/v3.22.1...v4.0.0) (2021-02-10)
### Features
* **child-process:** Add JSDoc types ([1840492](https://github.com/lerna/lerna/commit/1840492a6b9e832dafe7046157798e3157c2a13b))
* **deps:** Bump dependencies ([affed1c](https://github.com/lerna/lerna/commit/affed1ce0fce91f01b0a9eafe357db2d985b974f))
* **deps:** chalk@^4.1.0 ([d2a9ed5](https://github.com/lerna/lerna/commit/d2a9ed537139f49561a7e29b3ebf624c97f48c77))
* **deps:** execa@^4.1.0 ([9051dca](https://github.com/lerna/lerna/commit/9051dcab1a68b56db09b82ab0345c5f36bcfee2d))
* **deps:** execa@^5.0.0 ([d8100fd](https://github.com/lerna/lerna/commit/d8100fd9e0742b049ed16ac77e976ce34234ebfc))
* Drop support for Node v6.x & v8.x ([ff4bb4d](https://github.com/lerna/lerna/commit/ff4bb4da215555e3bb136f5af09b5cbc631e57bb))
### BREAKING CHANGES
* Node v6.x & v8.x are no longer supported. Please upgrade to the latest LTS release.
Here's the gnarly one-liner I used to make these changes:
```
npx lerna exec --concurrency 1 --stream -- 'json -I -f package.json -e '"'"'this.engines=this.engines||{};this.engines.node=">= 10.18.0"'"'"
```
(requires `npm i -g json` beforehand)
## [3.16.5](https://github.com/lerna/lerna/compare/v3.16.4...v3.16.5) (2019-10-07)

@@ -8,0 +35,0 @@

73

index.js

@@ -9,2 +9,3 @@ "use strict";

// bookkeeping for spawned processes
/** @type {Set<import("execa").ExecaChildProcess<string>>} */
const children = new Set();

@@ -19,2 +20,8 @@

/**
* Execute a command asynchronously, piping stdio by default.
* @param {string} command
* @param {string[]} args
* @param {import("execa").Options} [opts]
*/
function exec(command, args, opts) {

@@ -27,2 +34,8 @@ const options = Object.assign({ stdio: "pipe" }, opts);

/**
* Execute a command synchronously.
* @param {string} command
* @param {string[]} args
* @param {import("execa").SyncOptions} [opts]
*/
function execSync(command, args, opts) {

@@ -32,2 +45,8 @@ return execa.sync(command, args, opts).stdout;

/**
* Spawn a command asynchronously, _always_ inheriting stdio.
* @param {string} command
* @param {string[]} args
* @param {import("execa").Options} [opts]
*/
function spawn(command, args, opts) {

@@ -40,2 +59,9 @@ const options = Object.assign({}, opts, { stdio: "inherit" });

/**
* Spawn a command asynchronously, streaming stdio with optional prefix.
* @param {string} command
* @param {string[]} args
* @param {import("execa").Options} [opts]
* @param {string} [prefix]
*/
// istanbul ignore next

@@ -77,3 +103,11 @@ function spawnStreaming(command, args, opts, prefix) {

/**
* @param {import("execa").ExecaError<string>} result
* @returns {number}
*/
function getExitCode(result) {
if (result.exitCode) {
return result.exitCode;
}
// https://nodejs.org/docs/latest-v6.x/api/child_process.html#child_process_event_close

@@ -85,3 +119,2 @@ if (typeof result.code === "number") {

// https://nodejs.org/docs/latest-v6.x/api/errors.html#errors_error_code
// istanbul ignore else
if (typeof result.code === "string") {

@@ -91,9 +124,14 @@ return os.constants.errno[result.code];

// istanbul ignore next: extremely weird
throw new TypeError(`Received unexpected exit code value ${JSON.stringify(result.code)}`);
// we tried
return process.exitCode;
}
/**
* @param {string} command
* @param {string[]} args
* @param {import("execa").Options} opts
*/
function spawnProcess(command, args, opts) {
const child = execa(command, args, opts);
const drain = (code, signal) => {
const drain = (exitCode, signal) => {
children.delete(child);

@@ -105,2 +143,7 @@

}
// propagate exit code, if any
if (exitCode) {
process.exitCode = exitCode;
}
};

@@ -120,13 +163,13 @@

/**
* @param {import("execa").ExecaChildProcess<string> & { pkg?: import("@lerna/package").Package }} spawned
*/
function wrapError(spawned) {
if (spawned.pkg) {
return spawned.catch(err => {
// istanbul ignore else
if (err.code) {
// ensure code is always a number
err.code = getExitCode(err);
return spawned.catch((err) => {
// ensure exit code is always a number
err.exitCode = getExitCode(err);
// log non-lerna error cleanly
err.pkg = spawned.pkg;
}
// log non-lerna error cleanly
err.pkg = spawned.pkg;

@@ -146,1 +189,7 @@ throw err;

exports.getExitCode = getExitCode;
/**
* @typedef {object} ExecOpts Provided to any execa-based call
* @property {string} cwd
* @property {number} [maxBuffer]
*/

12

package.json
{
"name": "@lerna/child-process",
"version": "3.16.5",
"version": "4.0.0",
"description": "Lerna's internal child_process wrapper",

@@ -20,3 +20,3 @@ "keywords": [

"engines": {
"node": ">= 6.9.0"
"node": ">= 10.18.0"
},

@@ -35,7 +35,7 @@ "publishConfig": {

"dependencies": {
"chalk": "^2.3.1",
"execa": "^1.0.0",
"strong-log-transformer": "^2.0.0"
"chalk": "^4.1.0",
"execa": "^5.0.0",
"strong-log-transformer": "^2.1.0"
},
"gitHead": "f0574092a2db90142b3a27ec1a4941cddbdcdf62"
"gitHead": "4582c476e07dddddd6b2e3ab6e7f52c1f9eed59a"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc