Commit 504a960
Changed files (5)
docs/api.md
@@ -230,6 +230,8 @@ await spinner(() => $`long-running command`)
await spinner('working...', () => $`sleep 99`)
```
+And it's disabled for `CI` by default.
+
## glob()
The [globby](https://github.com/sindresorhus/globby) package.
docs/configuration.md
@@ -100,3 +100,14 @@ $.log = (entry: LogEntry) => {
}
}
```
+
+## $.timeout
+
+Specifies a timeout for the command execution.
+
+```js
+$.timeout = '1s'
+$.timeoutSignal= 'SIGKILL'
+
+await $`sleep 999`
+```
docs/contribution.md
@@ -56,4 +56,4 @@ All submissions, including submissions by project members, require review. We us
## License
-The project is licensed under the [Apache-2.0](https://github.com/google/zx?tab=Apache-2.0-1-ov-file#readme)
\ No newline at end of file
+The project is licensed under the [Apache-2.0](https://github.com/google/zx?tab=Apache-2.0-1-ov-file#readme)
docs/process-promise.md
@@ -58,7 +58,6 @@ await p.lines() // ['foo', 'bar']
await $`echo '{"foo": "bar"}'`.json() // {foo: 'bar'}
```
-
## `pipe()`
Redirects the output of the process.
@@ -87,6 +86,15 @@ const p = $`echo "hello"`
const o = await p
```
+And the `ProcessPromise` itself is compatible with the standard `Stream.pipe` API:
+
+```js
+const { stdout } = await fs
+ .createReadStream(await fs.writeFile(file, 'test'))
+ .pipe(getUpperCaseTransform())
+ .pipe($`cat`)
+```
+
Pipes can be used to show a real-time output of the process:
```js
@@ -161,7 +169,7 @@ In short, combine anything you want:
```js
const getUpperCaseTransform = () => new Transform({
transform(chunk, encoding, callback) {
- callback(null, String(chunk).toUpperCase())
+ callback(null, String(chunk).toUpperCase())
},
})
docs/setup.md
@@ -5,7 +5,7 @@
* JavaScript Runtime:
* Node.js 12.17.0 or later
* Bun 1.0.0 or later
- * Deno 1.x
+ * Deno 1.x, 2.x
* Some kind of bash or PowerShell
## Install
@@ -74,8 +74,8 @@ const opts: Options = {
We use [esbuild](https://dev.to/antongolub/how-and-why-do-we-bundle-zx-1ca6) to produce a static build that allows us to solve several issues at once:
* Reduce the pkg size and install time.
* Make npx (yarn dlx / bunx) invocations reproducible.
-* Provide support for wide range of Node.js versions: from 12 to 22.
-* Make auditing easier: complete code in one place.
+* Provide support for wide range of Node.js versions: from 12 to 23.
+* Make auditing easier: complete code is in one place.
### Composite
@@ -85,3 +85,8 @@ zx exports several entry points adapted for different use cases:
* `zx/cli` – to run zx scripts from the command line.
* `zx/core` – to use zx template spawner as part of 3rd party libraries with alternating set of utilities.
+### Typed
+The library is written in TypeScript 5 and provides comprehensive type definitions for TS users.
+* Libdefs are bundled via [dts-bundle-generator](https://github.com/timocov/dts-bundle-generator).
+* Compatible with TS 4.0 and later.
+* Requires `@types/node` and `@types/fs-extra` to be installed.