Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
zx

zx

> 编程语言
Free

A tool for writing better scripts

45.9K stars0 likes5 views
WebsiteGitHub

About

A tool for writing better scripts

zx

javascript
#!/usr/bin/env zx

await $`cat package.json | grep name`

const branch = await $`git branch --show-current`
await $`dep deploy --branch=${branch}`

await Promise.all([
  $`sleep 1; echo 1`,
  $`sleep 2; echo 2`,
  $`sleep 3; echo 3`,
])

const name = 'foo bar'
await $`mkdir /tmp/${name}`

Bash is great, but when it comes to writing more complex scripts, many people prefer a more convenient programming language. JavaScript is a perfect choice, but the Node.js standard library requires additional hassle before using. No compromise, take the best of both. The zx package provides useful cross-platform wrappers around child_process, escapes arguments and gives sensible defaults.

Install

bash
npm install zx

All setup options: zx/setup. See also zx@lite.

Usage

  • Documentation at google.github.io/zx/
  • Code examples

Compatibility

  • Linux, macOS, or Windows
  • JavaScript Runtime:
    • Node.js >= 12.17.0
    • Bun >= 1.0.0
    • Deno 1.x, 2.x
    • GraalVM Node.js
  • Bash or PowerShell
  • Both CJS or ESM modules in JS or TS

See also

  • MAML — JSON for config, with comments, multiline strings, unquoted keys, and optional commas.

License

Apache-2.0

Disclaimer: This is not an officially supported Google product.

Issues· 64 open

View all issuesOpen on GitHub
  • #543

    Some characters like dash breaks commands / arguments highlighting

    bugUpdated Sep 25, 2026
  • #525

    Improve `--install`

    featureresearchUpdated Sep 25, 2026
  • #1505

    `ProcessOutput.json()` parses combined stdout+stderr, breaking on CLIs that log progress to stderr

    Updated Sep 4, 2026
  • #1443

    [Bug]: Unhandled promise rejection in fetch().pipe() when response stream errors

    Updated May 17, 2026
  • #1211

    Paths in Git Bash on Windows don't work

    Updated May 7, 2026
  • #1378

    [Bug]: Interactive prompting does not work

    bugUpdated Feb 24, 2026
  • #1383

    Why does`deno run` not use `jsr:@webpod/zx`?

    bugUpdated Feb 23, 2026
  • #1389

    [Bug]: TypeError: $(...) is not a function

    bugUpdated Feb 22, 2026
  • #1388

    [Bug]: cannot parse indented content

    bugUpdated Jan 24, 2026
  • #1375

    [Idea]: Worker pools

    featureUpdated Dec 8, 2025

> Tags

JavaScriptbashchild-processcli

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedDec 4, 2026
Category编程语言
PricingFree

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言