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.12.0 to 1.13.0

43

index.d.ts

@@ -31,7 +31,2 @@ // Copyright 2021 Google LLC

export type cd = (path: string) => void
export type sleep = (ms: number) => Promise<void>
export type question = (query?: string, options?: QuestionOptions) => Promise<string>
export type QuestionOptions = { choices: string[] }
export interface ProcessPromise<T> extends Promise<T> {

@@ -55,13 +50,31 @@ child: ChildProcess

export type QuestionOptions = { choices: string[] }
type cd = (path: string) => void
type nothrow = (p: ProcessPromise<ProcessOutput>) => ProcessPromise<ProcessOutput>
type sleep =(ms: number) => Promise<void>
type question = (query?: string, options?: QuestionOptions) => Promise<string>
type fs = typeof _fs & {
createWriteStream: typeof createWriteStream
createReadStream: typeof createReadStream
}
export const $: $
export const cd: cd
export const nothrow: nothrow
export const sleep: sleep
export const question: question
export const chalk: typeof _chalk
export const fs: fs
export const os: typeof _os
declare global {
export const $: $
export const cd: cd
export const sleep: sleep
export const question: question
export const chalk: typeof _chalk
export const fs: typeof _fs & {
createWriteStream: typeof createWriteStream
createReadStream: typeof createReadStream
}
export const os: typeof _os
const $: $
const cd: cd
const nothrow: nothrow
const sleep: sleep
const question: question
const chalk: typeof _chalk
const fs: fs
const os: typeof _os
}
{
"name": "zx",
"version": "1.12.0",
"version": "1.13.0",
"description": "A tool for writing better scripts",

@@ -5,0 +5,0 @@ "main": "index.mjs",

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

### `ProcessPromise`
#### `ProcessPromise`

@@ -112,3 +112,3 @@ ```ts

### `ProcessOutput`
#### `ProcessOutput`

@@ -124,4 +124,6 @@ ```ts

### `cd()`
### Functions
#### `cd()`
Changes the current working directory.

@@ -134,3 +136,3 @@

### `fetch()`
#### `fetch()`

@@ -146,3 +148,3 @@ A wrapper around the [node-fetch](https://www.npmjs.com/package/node-fetch) package.

### `question()`
#### `question()`

@@ -167,12 +169,6 @@ A wrapper around the [readline](https://nodejs.org/api/readline.html) package.

### `sleep()`
#### `sleep()`
A wrapper around the `setTimeout` function.
```ts
function sleep(ms: number): Promise<void>
```
Usage:
```js

@@ -182,3 +178,3 @@ await sleep(1000)

### `nothrow()`
#### `nothrow()`

@@ -217,7 +213,10 @@ Changes behavior of `$` to not throw an exception on non-zero exit codes.

### `chalk` package
### Packages
The [chalk](https://www.npmjs.com/package/chalk) package is available without
importing inside scripts.
Next packages is available without importing inside scripts.
#### `chalk` package
The [chalk](https://www.npmjs.com/package/chalk) package.
```js

@@ -227,6 +226,5 @@ console.log(chalk.blue('Hello world!'))

### `fs` package
#### `fs` package
The [fs](https://nodejs.org/api/fs.html) package is available without importing
inside scripts. It is asynchronous by default.
The [fs](https://nodejs.org/api/fs.html) package.

@@ -239,4 +237,3 @@ ```js

The [os](https://nodejs.org/api/os.html) package is available without importing
inside scripts.
The [os](https://nodejs.org/api/os.html) package.

@@ -247,4 +244,6 @@ ```js

### `$.shell`
### Configuration
#### `$.shell`
Specifies what shell is used. Default is `which bash`.

@@ -256,3 +255,3 @@

### `$.prefix`
#### `$.prefix`

@@ -263,3 +262,3 @@ Specifies the command that will be prefixed to all commands run.

### `$.quote`
#### `$.quote`

@@ -271,3 +270,3 @@ Specifies a function for escaping special characters during

### `$.verbose`
#### `$.verbose`

@@ -279,4 +278,6 @@ Specifies verbosity. Default is `true`.

### `__filename` & `__dirname`
### Polyfills
#### `__filename` & `__dirname`
In [ESM](https://nodejs.org/api/esm.html) modules, Node.js does not provide

@@ -286,3 +287,3 @@ `__filename` and `__dirname` globals. As such globals are really handy in scripts,

### `require()`
#### `require()`

@@ -298,4 +299,6 @@ In [ESM](https://nodejs.org/api/modules.html#modules_module_createrequire_filename)

### Passing env variables
### FAQ
#### Passing env variables
```js

@@ -306,3 +309,3 @@ process.env.FOO = 'bar'

### Passing array of values
#### Passing array of values

@@ -318,3 +321,3 @@ If array of values passed as argument to `$`, items of the array will be escaped

### Importing from other scripts
#### Importing from other scripts

@@ -329,3 +332,3 @@ It is possible to make use of `$` and other functions via explicit imports:

### Scripts without extensions
#### Scripts without extensions

@@ -336,12 +339,12 @@ If script does not have a file extension (like `.git/hooks/pre-commit`), zx

### Markdown scripts
#### Markdown scripts
The `zx` can execute scripts written in markdown
([examples/index.md](examples/index.md)):
([examples/index.md](examples/markdown.md)):
```bash
zx examples/index.md
zx examples/markdown.md
```
### TypeScript scripts
#### TypeScript scripts

@@ -376,3 +379,3 @@ The `zx` can compile `.ts` scripts to `.mjs` and execute them.

### Executing remote scripts
#### Executing remote scripts

@@ -379,0 +382,0 @@ If the argument to the `zx` executable starts with `https://`, the file will be

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