๐Ÿ“ฆ google / zx

A tool for writing better scripts

โ˜… 45.1k stars โ‘‚ 1.2k forks ๐Ÿ‘ 45.1k watching โš–๏ธ Apache License 2.0
bashchild-processcliexecjavascriptnodejspipeshellspawn
๐Ÿ“ฅ Clone https://github.com/google/zx.git
HTTPS git clone https://github.com/google/zx.git
SSH git clone git@github.com:google/zx.git
CLI gh repo clone google/zx
Anton Golub Anton Golub chore: update globby to v16.1.0, up dev deps (#1384) 0142804 11 days ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ build
๐Ÿ“ dcr
๐Ÿ“ docs
๐Ÿ“ examples
๐Ÿ“ man
๐Ÿ“ scripts
๐Ÿ“ src
๐Ÿ“ test
๐Ÿ“ test-d
๐Ÿ“„ .commitlintrc
๐Ÿ“„ .gitattributes
๐Ÿ“„ .gitignore
๐Ÿ“„ .node_version
๐Ÿ“„ .nycrc
๐Ÿ“„ .prettierignore
๐Ÿ“„ .size-limit.json
๐Ÿ“„ lefthook.yml
๐Ÿ“„ LICENSE
๐Ÿ“„ package-lock.json
๐Ÿ“„ package.json
๐Ÿ“„ README.md
๐Ÿ“„ tsconfig.json
๐Ÿ“„ README.md

Zx logo zx

#!/usr/bin/env zx

await 

Zx logo zx

cat package.json | grep name` const branch = await

Zx logo zx

git branch --show-current` await

Zx logo zx

dep deploy --branch=${branch}` await Promise.all([

Zx logo zx

sleep 1; echo 1`,

Zx logo zx

sleep 2; echo 2`,

Zx logo zx

sleep 3; echo 3`, ]) const name = 'foo bar' await

Zx logo zx

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

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

Usage

Compatibility

  • Linux, macOS, or Windows
  • JavaScript Runtime:
  • Node.js >= 12.17.0
  • Bun >= 1.0.0
  • Deno 1.x, 2.x

See also

  • srf โ€” a tiny, dependency-free static file server for Node.js
  • fx โ€” a JSON cli tool and terminal JSON viewer

License

Apache-2.0

Disclaimer: This is not an officially supported Google product.