Commit b8fa07b
Changed files (4)
docs
docs/.vitepress/config.mts
@@ -69,6 +69,7 @@ export default defineConfig({
{ text: 'Process Output', link: '/process-output' },
{ text: 'Contribution Guide', link: '/contribution' },
{ text: 'Migration from v7', link: '/migration-from-v7' },
+ { text: '⚡ zx@lite ', link: '/lite' },
],
},
{
docs/lite.md
@@ -0,0 +1,22 @@
+# zx@lite
+
+Just core functions without extras:
+* ~7x smaller than the full version
+* No CLI, no docs, no manpage assets embedded
+* Same package name, but different publish channel — `@lite`
+* Less code — ~~less risks~~ faster and more reliable ISEC audit
+* Recommended for custom toolkits based on zx
+
+```sh
+npm i zx@lite
+npm i zx@8.5.5-lite
+```
+Detailed comparison: [versions](./versions)
+
+```js
+import { $ } from 'zx'
+await $`echo foo`
+```
+
+### Range of choices
+**tool size ← [`child_process`](https://nodejs.org/api/child_process.html) [`zurk`](https://github.com/webpod/zurk) `zx@lite` `zx` → built-in functionality**
docs/process-promise.md
@@ -120,7 +120,7 @@ await $`echo "Hello, stdout!"`
.pipe('/tmp/output.txt')
```
-Chained streams becomes _thenables_, so you can `await` them:
+Chained streams become _thenables_, so you can `await` them:
```js
const p = $`echo "hello"`
@@ -158,6 +158,15 @@ setTimeout(() => { piped2 = result.pipe`cat` }, 1500)
(await piped2).toString() // '1\n2\n3\n'
```
+This mechanism allows you to easily split streams to multiple consumers:
+```js
+const p = $`some-command`
+const [o1, o2] = await Process.all([
+ await p.pipe`log`,
+ await p.pipe`extract`
+])
+```
+
The `pipe()` method can combine `$` processes. Same as `|` in bash:
```js
docs/setup.md
@@ -62,7 +62,7 @@ brew install zx
### Channels
zx is distributed in several versions, each with its own set of features.
-* Extracted zx core functions go to the [`lite`](https://www.npmjs.com/package/zx?activeTab=versions) channel: `npm i zx@lite`.
+* Extracted zx core functions go to the [`lite`](./lite) channel: `npm i zx@lite`.
* Dev snapshots are published to npm under the [`dev` tag](https://www.npmjs.com/package/zx?activeTab=versions): `npm i zx@dev`.
Detailed comparison: [versions](./versions).