Socket
Socket
Sign inDemoInstall

zx

Package Overview
Dependencies
Maintainers
2
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zx - npm Package Compare versions

Comparing version 1.8.0 to 1.9.0

13

index.d.ts

@@ -15,4 +15,7 @@ // Copyright 2021 Google LLC

import {ChildProcess} from 'child_process'
import {Readable, Writable} from 'stream'
interface $ {
(pieces: TemplateStringsArray, ...args: any[]): Promise<ProcessOutput>
(pieces: TemplateStringsArray, ...args: any[]): ProcessPromise<ProcessOutput>
verbose: boolean

@@ -34,2 +37,10 @@ shell: string

export interface ProcessPromise<T> extends Promise<T> {
child: ChildProcess
readonly stdin: Writable
readonly stdout: Readable
readonly stderr: Readable
pipe(dest: ProcessPromise<ProcessOutput>|Writable): ProcessPromise<ProcessOutput>
}
export class ProcessOutput {

@@ -36,0 +47,0 @@ readonly exitCode: number

3

package.json
{
"name": "zx",
"version": "1.8.0",
"version": "1.9.0",
"description": "A tool for writing better scripts",

@@ -17,2 +17,3 @@ "main": "index.mjs",

"dependencies": {
"@types/node": "^15.3",
"chalk": "^4.1.1",

@@ -19,0 +20,0 @@ "node-fetch": "^2.6.1",

@@ -63,3 +63,3 @@ # 🐚 zx

Executes a given string using the `exec` function from the
`child_process` package and returns `Promise<ProcessOutput>`.
`child_process` package and returns `ProcessPromise<ProcessOutput>`.

@@ -92,2 +92,21 @@ ```js

### `ProcessPromise`
```ts
class ProcessPromise<T> extends Promise<T> {
readonly stdin: Writable
readonly stdout: Readable
readonly stderr: Readable
pipe(dest): ProcessPromise<T>
}
```
The `pipe()` method can be used to redirect stdout:
```js
await $`cat file.txt`.pipe(process.stdout)
```
Read more about [pipelines](examples/pipelines.md).
### `ProcessOutput`

@@ -195,3 +214,3 @@

Specifies the command what will be prefixed to all commands run.
Specifies the command that will be prefixed to all commands run.

@@ -202,3 +221,3 @@ Default is `set -euo pipefail;`.

Specifies a function what will be used for escaping special characters during
Specifies a function for escaping special characters during
command substitution.

@@ -263,3 +282,3 @@

If script does not have a file extension (like `.git/hooks/pre-commit`), zx
assumes what it is a [ESM](https://nodejs.org/api/modules.html#modules_module_createrequire_filename)
assumes that it is an [ESM](https://nodejs.org/api/modules.html#modules_module_createrequire_filename)
module.

@@ -266,0 +285,0 @@

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

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