@npmcli/run-script
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -14,2 +14,3 @@ const isWindows = require('./is-windows.js') | ||
cmd, | ||
stdioString = false, | ||
} = options | ||
@@ -30,2 +31,3 @@ | ||
}), | ||
stdioString, | ||
stdio, | ||
@@ -32,0 +34,0 @@ cwd: path, |
@@ -23,2 +23,11 @@ const {spawn} = require('child_process') | ||
const stdioResult = (stdout, stderr, {stdioString}) => | ||
stdioString ? { | ||
stdout: Buffer.concat(stdout).toString(), | ||
stderr: Buffer.concat(stderr).toString(), | ||
} : { | ||
stdout: Buffer.concat(stdout), | ||
stderr: Buffer.concat(stderr), | ||
} | ||
const promiseSpawnUid = (cmd, args, opts, extra) => | ||
@@ -30,4 +39,3 @@ new Promise((res, rej) => { | ||
const reject = er => rej(Object.assign(er, { | ||
stdout: Buffer.concat(stdout), | ||
stderr: Buffer.concat(stderr), | ||
...stdioResult(stdout, stderr, opts), | ||
...extra, | ||
@@ -44,4 +52,3 @@ })) | ||
signal, | ||
stdout: Buffer.concat(stdout), | ||
stderr: Buffer.concat(stderr), | ||
...stdioResult(stdout, stderr, opts), | ||
...extra | ||
@@ -48,0 +55,0 @@ } |
@@ -13,2 +13,3 @@ const makeSpawnArgs = require('./make-spawn-args.js') | ||
args = [], | ||
stdioString = false, | ||
} = options | ||
@@ -32,2 +33,3 @@ | ||
cmd, | ||
stdioString, | ||
}), { | ||
@@ -34,0 +36,0 @@ event, |
{ | ||
"name": "@npmcli/run-script", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Run a lifecycle script for a package (descendant of npm-lifecycle)", | ||
@@ -5,0 +5,0 @@ "author": "Isaac Z. Schlueter <i@izs.me> (https://izs.me)", |
@@ -20,2 +20,6 @@ # @npmcli/run-script | ||
// optional, defaults to false | ||
// return stdout and stderr as strings rather than buffers | ||
stdioString: true, | ||
// optional, additional environment variables to add | ||
@@ -69,4 +73,4 @@ // note that process.env IS inherited by default | ||
- `signal` Process exit signal | ||
- `stdout` Buffer of stdout data | ||
- `stderr` Buffer of stderr data | ||
- `stdout` stdout data (Buffer, or String when `stdioString` set to true) | ||
- `stderr` stderr data (Buffer, or String when `stdioString` set to true) | ||
- `path` Path to the package executing its script | ||
@@ -96,2 +100,4 @@ - `event` Lifecycle event being run | ||
something else, which will be run in an otherwise matching environment. | ||
- `stdioString` Optional, defaults to `false`. Return string values for | ||
`stderr` and `stdout` rather than Buffers. | ||
@@ -98,0 +104,0 @@ Note that this does _not_ run pre-event and post-event scripts. The |
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
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
13075
202
130