Comparing version 6.2.1 to 6.2.2
@@ -9,3 +9,3 @@ /// <reference types="node" resolution-mode="require"/> | ||
prefix: string; | ||
shell: string; | ||
shell: string | boolean; | ||
maxBuffer: number; | ||
@@ -29,2 +29,2 @@ quote: (v: string) => string; | ||
export declare function getRootCtx(): Options; | ||
export declare const runInCtx: <R, TArgs extends any[]>(store: Options, callback: (...args: TArgs) => R, ...args: TArgs) => R; | ||
export declare const runInCtx: <R, TArgs extends any[]>(ctx: Options | undefined, cb: (...args: TArgs) => R, ...args: TArgs) => R; |
@@ -18,3 +18,3 @@ // Copyright 2022 Google LLC | ||
export function getCtx() { | ||
return storage.getStore(); | ||
return storage.getStore() || getRootCtx(); | ||
} | ||
@@ -28,2 +28,2 @@ export function setRootCtx(ctx) { | ||
} | ||
export const runInCtx = storage.run.bind(storage); | ||
export const runInCtx = (ctx = root, cb, ...args) => storage.run(ctx, cb, ...args); |
@@ -49,3 +49,3 @@ // Copyright 2021 Google LLC | ||
} | ||
promise.ctx = { | ||
const ctx = { | ||
...getCtx(), | ||
@@ -57,2 +57,3 @@ cmd, | ||
}; | ||
Object.defineProperty(promise, 'ctx', { value: ctx }); | ||
setImmediate(() => promise._run()); // Make sure all subprocesses are started, if not explicitly by await or then(). | ||
@@ -68,2 +69,3 @@ return promise; | ||
$.prefix = ''; // Bash not found, no prefix. | ||
$.shell = true; | ||
try { | ||
@@ -70,0 +72,0 @@ $.shell = which.sync('bash'); |
@@ -20,2 +20,3 @@ // Copyright 2022 Google LLC | ||
import { colorize } from './print.js'; | ||
import { log } from './print.js'; | ||
export { default as chalk } from 'chalk'; | ||
@@ -34,10 +35,3 @@ export { default as fs } from 'fs-extra'; | ||
export async function fetch(url, init) { | ||
if (getCtx().verbose) { | ||
if (typeof init !== 'undefined') { | ||
console.log('$', colorize(`fetch ${url}`), init); | ||
} | ||
else { | ||
console.log('$', colorize(`fetch ${url}`)); | ||
} | ||
} | ||
log({ scope: 'fetch' }, '$', colorize(`fetch ${url}`), init && JSON.stringify(init, null, 2)); | ||
return nodeFetch(url, init); | ||
@@ -44,0 +38,0 @@ } |
{ | ||
"name": "zx", | ||
"version": "6.2.1", | ||
"version": "6.2.2", | ||
"description": "A tool for writing better scripts.", | ||
@@ -54,3 +54,3 @@ "type": "module", | ||
"minimist": "^1.2.6", | ||
"node-fetch": "^3.2.4", | ||
"node-fetch": "^3.2.5", | ||
"ps-tree": "^1.2.0", | ||
@@ -57,0 +57,0 @@ "which": "^2.0.2", |
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
63825
969
Updatednode-fetch@^3.2.5