Commit d5be4ca
Changed files (5)
docs/cli.md
@@ -1,11 +1,18 @@
# CLI Usage
-Zx provides a CLI for running scripts. It is installed with the package and can be used as `zx` executable.
+Zx provides a CLI for running scripts. It comes with the package and can be used as `zx` executable (if referenced in package.json `"scripts"`, installed [globally](/setup#install) or added to the `$PATH` somehow).
```sh
zx script.mjs
```
+`npx` or `node` inits are valid too.
+```sh
+npx zx script.mjs
+node -r zx/globals script.mjs
+node --import zx/globals script.mjs
+```
+
## No extensions
If script does not have a file extension (like `.git/hooks/pre-commit`), zx
docs/setup.md
@@ -13,7 +13,12 @@
::: code-group
```bash [npm]
-npm install zx
+npm install zx # add -g to install globally
+```
+
+```bash [npx]
+npx zx script.js # run script without installing the zx package
+npx zx@8.5.0 script.js # pin to a specific zx version
```
```bash [yarn]
@@ -61,7 +66,7 @@ zx is distributed in several versions, each with its own set of features.
Detailed comparison: [versions](./versions).
-Please check the download sources carefully. Official links are:
+Please check the download sources carefully. Official links:
* [npmjs](https://www.npmjs.com/package/zx)
* [GH npm](https://github.com/google/zx/pkgs/npm/zx)
@@ -70,6 +75,17 @@ Please check the download sources carefully. Official links are:
* [JSR](https://jsr.io/@webpod/zx)
* [Homebrew](https://github.com/Homebrew/homebrew-core/blob/master/Formula/z/zx.rb)
+### Github
+To fetch zx directly from the GitHub:
+```bash
+# Install via git
+npm i google/zx
+npm i git@github.com:google/zx.git
+
+# Fetch from the GH pkg registry
+npm i --registry=https://npm.pkg.github.com @google/zx
+```
+
### Docker
If you'd prefer to run scripts in a container, you can pull the zx image from the [ghcr.io](https://ghcr.io).
[node:22-alpine](https://hub.docker.com/_/node) is used as [a base](https://github.com/google/zx/blob/main/dcr/Dockerfile).
docs/typescript.md
@@ -56,6 +56,8 @@ swc-node script.ts
npm install tsx
tsx script.ts
+# or
+node --import=tsx script.ts
```
```bash [bun]
.size-limit.json
@@ -17,7 +17,7 @@
"README.md",
"LICENSE"
],
- "limit": "114.25 kB",
+ "limit": "114.35 kB",
"brotli": false,
"gzip": false
},
@@ -45,7 +45,7 @@
{
"name": "all",
"path": ["build/*", "man/*", "README.md", "LICENSE"],
- "limit": "871.5 kB",
+ "limit": "871.6 kB",
"brotli": false,
"gzip": false
}
README.md
@@ -22,7 +22,7 @@ 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. The `zx` package provides
-useful wrappers around `child_process`, escapes arguments and
+useful cross-platform wrappers around `child_process`, escapes arguments and
gives sensible defaults.
## Install
@@ -30,6 +30,7 @@ gives sensible defaults.
```bash
npm install zx
```
+Complete installation instructions: [zx/setup](https://google.github.io/zx/setup)
## Documentation