8.1.0
版本发布时间: 2024-05-14 05:05:27
google/zx最新发布版本:8.1.4(2024-07-04 18:44:34)
This new release is a big deal. It brings significant improvements in reliability and compatibility.
- Switched to hybrid-scheme package: both ESM and CJS entry points are provided.
- Extended Node.js supported versions range: from 12.17.0 to the latest 22.x.x.
- Added compatibility with Deno 1.x.
- zx libdefs are now compatible with TS 4.0+.
New features
Added usePwsh()
helper to switch to PowerShell v7+ #790
import {usePwsh, useBash} from 'zx'
usePwsh()
$.shell // 'pwsh'
useBash()
$.shell // 'bash'
timeout
is now configurable $
opts #796
import {$} from 'zx'
await $({ timeout: 100 })`sleep 999`
$.timeout = 1000 // Sets default timeout for all commands
$.timeoutSignal = 'SIGKILL' // Sets signal to send on timeout
await $`sleep 999`
Added --cwd
option for CLI #804
zx --cwd=/some/path script.js
Introduced tmpdir
and tmpfile
helpers #803
import {tmpdir, tmpfile} from 'zx'
t1 = tmpdir() // /os/based/tmp/zx-1ra1iofojgg/
t2 = tmpdir('foo') // /os/based/tmp/zx-1ra1iofojgg/foo/
f1 = tmpfile() // /os/based/tmp/zx-1ra1iofojgg
f2 = tmpfile('f.txt') // /os/based/tmp/zx-1ra1iofojgg/foo.txt
f3 = tmpfile('f.txt', 'string or buffer')