zx
Advanced tools
Comparing version 6.0.3 to 6.0.4
{ | ||
"name": "zx", | ||
"version": "6.0.3", | ||
"version": "6.0.4", | ||
"description": "A tool for writing better scripts.", | ||
@@ -35,2 +35,3 @@ "main": "src/index.mjs", | ||
"@types/node": "^17.0", | ||
"@types/which": "^2.0.1", | ||
"chalk": "^5.0.1", | ||
@@ -37,0 +38,0 @@ "fs-extra": "^10.0.1", |
@@ -303,2 +303,12 @@ # 🐚 zx | ||
#### `which` | ||
The [which](https://github.com/npm/node-which) package. | ||
```js | ||
let node = await which('node') | ||
let node = which.sync('node') | ||
``` | ||
### Configuration | ||
@@ -412,2 +422,12 @@ | ||
#### `withTimeout()` | ||
Runs and sets a timeout for a cmd. | ||
```js | ||
import {withTimeout} from 'zx/experimental' | ||
await withTimeout(100, 'SIGTERM')`sleep 9999` | ||
``` | ||
### FAQ | ||
@@ -519,2 +539,14 @@ | ||
#### Attaching .bash_profile/.zshrc | ||
By default `child_process` does not include aliases and bash functions. | ||
But you are still able to do it by hand. Just attach necessary directives to `$.prefix`. | ||
```js | ||
{ | ||
$.prefix += 'export NVM_DIR=$HOME/.nvm; source $NVM_DIR/nvm.sh; ' | ||
await $`nvm -v` | ||
} | ||
``` | ||
## License | ||
@@ -521,0 +553,0 @@ |
@@ -15,3 +15,3 @@ // Copyright 2021 Google LLC | ||
import {ProcessOutput} from './index' | ||
import {ZxTemplate} from './index' | ||
@@ -24,8 +24,7 @@ interface Echo { | ||
interface Retry { | ||
(pieces: TemplateStringsArray, ...args: any[]): Promise<ProcessOutput> | ||
} | ||
export const retry: (count?: number, delay?: number) => Retry | ||
export const retry: (count?: number, delay?: number) => ZxTemplate | ||
export const withTimeout: (delay?: number, signal?: string | number) => ZxTemplate | ||
type StopSpinner = () => void | ||
export function startSpinner(title: string): StopSpinner |
@@ -14,2 +14,3 @@ import { | ||
sleep, | ||
which as _which, | ||
} from './index' | ||
@@ -32,2 +33,3 @@ | ||
var sleep: sleep | ||
var which: typeof _which | ||
} |
@@ -25,6 +25,9 @@ // Copyright 2021 Google LLC | ||
import {ParsedArgs} from 'minimist' | ||
import * as _which from 'which' | ||
interface $ { | ||
export interface ZxTemplate { | ||
(pieces: TemplateStringsArray, ...args: any[]): ProcessPromise<ProcessOutput> | ||
} | ||
interface $ extends ZxTemplate { | ||
verbose: boolean | ||
@@ -82,1 +85,2 @@ shell: string | ||
export const quiet: quiet | ||
export const which: typeof _which |
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
Sorry, the diff of this file is not supported yet
53745
993
554
12
+ Added@types/which@^2.0.1
+ Added@types/which@2.0.2(transitive)