Comparing version 1.11.0 to 1.12.0
@@ -41,2 +41,3 @@ // Copyright 2021 Google LLC | ||
readonly stderr: Readable | ||
readonly exitCode: Promise<number> | ||
@@ -43,0 +44,0 @@ pipe(dest: ProcessPromise<ProcessOutput> | Writable): ProcessPromise<ProcessOutput> |
{ | ||
"name": "zx", | ||
"version": "1.11.0", | ||
"version": "1.12.0", | ||
"description": "A tool for writing better scripts", | ||
@@ -5,0 +5,0 @@ "main": "index.mjs", |
@@ -98,2 +98,3 @@ # 🐚 zx | ||
readonly stderr: Readable | ||
readonly exitCode: Promise<number> | ||
pipe(dest): ProcessPromise<T> | ||
@@ -115,5 +116,5 @@ } | ||
class ProcessOutput { | ||
readonly exitCode: number | ||
readonly stdout: string | ||
readonly stderr: string | ||
readonly exitCode: number | ||
toString(): string | ||
@@ -177,2 +178,36 @@ } | ||
### `nothrow()` | ||
Changes behavior of `$` to not throw an exception on non-zero exit codes. | ||
```ts | ||
function nothrow<P>(p: P): P | ||
``` | ||
Usage: | ||
```js | ||
await nothrow($`grep something from-file`) | ||
// Inside a pipe(): | ||
await $`find ./examples -type f -print0` | ||
.pipe(nothrow($`xargs -0 grep something`)) | ||
.pipe($`wc -l`) | ||
``` | ||
If only the `exitCode` is needed, you can use the next code instead: | ||
```js | ||
if (await $`[[ -d path ]]`.exitCode == 0) { | ||
... | ||
} | ||
// Equivalent of: | ||
if ((await nothrow($`[[ -d path ]]`)).exitCode == 0) { | ||
... | ||
} | ||
``` | ||
### `chalk` package | ||
@@ -295,4 +330,3 @@ | ||
The `zx` can compile `.ts` scripts to `.mjs` by running `tsc` (should be | ||
installed on local machine). | ||
The `zx` can compile `.ts` scripts to `.mjs` and execute them. | ||
@@ -299,0 +333,0 @@ ```bash |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
34870
554
369