Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
j50n committed Oct 26, 2024
1 parent f1e8084 commit 8ff583a
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 47 deletions.
38 changes: 26 additions & 12 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,32 @@ <h1 class="menu-title">proc</h1>
<div id="content" class="content">
<main>
<h1 id="proc-0221"><a class="header" href="#proc-0221"><code>proc 0.22.1</code></a></h1>
<p><code>proc</code> let's you use child processes with
<p>When I started this project, Deno was still young. My goal was to create a better way to run
child processes. I realized the Deno had the potential to be a better version of Bash scripting.
In its simplest form, a Deno script can run standalone, without external configuration or compilation.
A big selling point is the security-by-default, which is a problem for system admins who run Bash
scripts with <code>root</code> privileges.
However, the young Deno lacked a lightweight, fluent way to run child processes - something that Bash is exceedingly good at.</p>
<p>Fast forward a few years and a few rewrites. The library has become a way to work with streaming data (files, IO, etc.) using
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator"><code>AsyncIterable</code></a>
instead of JavaScript streams for everything. You can use <code>map</code>, <code>filter</code>, <code>find</code>, and a whole bunch of other
methods just like you would on an <code>Array</code>, but they are streamed and lazy. Errors work the
way you expect them to. You can process through terrabytes of information while using very little memory.</p>
<p>It also lets you <code>run</code> child processes. Yeah, that part turned out really good. It's easy. It's almost trivial.
You can run processes concurrently. There is a little more boilerplate than Bash, you know, because it
uses Typescript syntax - but it is really minimal and easy to read. Deno has improved their process runner since the old days, but
this is still better.</p>
<!-- `proc` let's you use child processes with
[`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator)
instead of the streams API, and it includes a library of higher-order functions
for <code>AsyncIterator</code> via
<a href="https://deno.land/x/proc@0.22.1/mod.ts?s=Enumerable"><code>Enumerable</code></a> that
roughly matches what you can do with an array (<code>map</code>, <code>filter</code>, <code>find</code>), but for
asynchronous code.</p>
<p><code>proc</code> simplifies the process of converting a <code>bash</code> script into a Deno
for `AsyncIterator` via
[`Enumerable`](https://deno.land/x/proc@0.22.1/mod.ts?s=Enumerable) that
roughly matches what you can do with an array (`map`, `filter`, `find`), but for
asynchronous code. -->
<!-- `proc` simplifies the process of converting a `bash` script into a Deno
application. The intention is to make writing code that uses lots of IO and
child processes <em>almost</em> as easy as shell scripting, but you also get proper
error handling, type checking, and Deno's security-by-default.</p>
child processes _almost_ as easy as shell scripting, but you also get proper
error handling, type checking, and Deno's security-by-default. -->
<p><a href="https://deno.land/x/proc@0.22.1/mod.ts">Developer Documentation</a></p>
<h2 id="usage"><a class="header" href="#usage">Usage</a></h2>
<pre><code class="language-typescript">import { run } from "https://deno.land/x/proc@0.22.1/mod.ts";
Expand All @@ -211,13 +226,12 @@ <h2 id="a-better-example"><a class="header" href="#a-better-example">A Better Ex
</ul>
</li>
</ul>
<pre><code class="language-typescript">const [words1, words2] = read(
fromFileUrl(import.meta.resolve("./warandpeace.txt.gz")),
)
<pre><code class="language-typescript">const [words1, words2] =
read(fromFileUrl(import.meta.resolve("./warandpeace.txt.gz")))
.transform(gunzip)
.lines
.map((line) =&gt; line.toLocaleLowerCase())
.run({ buffer: true }, "grep", "-oE", "(\\w|')+")
.run("grep", "-oE", "(\\w|')+") // grep out the words to individual lines
.tee();

const [uniqueWords, totalWords] = await Promise.all([
Expand Down
38 changes: 26 additions & 12 deletions docs/introduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,32 @@ <h1 class="menu-title">proc</h1>
<div id="content" class="content">
<main>
<h1 id="proc-0221"><a class="header" href="#proc-0221"><code>proc 0.22.1</code></a></h1>
<p><code>proc</code> let's you use child processes with
<p>When I started this project, Deno was still young. My goal was to create a better way to run
child processes. I realized the Deno had the potential to be a better version of Bash scripting.
In its simplest form, a Deno script can run standalone, without external configuration or compilation.
A big selling point is the security-by-default, which is a problem for system admins who run Bash
scripts with <code>root</code> privileges.
However, the young Deno lacked a lightweight, fluent way to run child processes - something that Bash is exceedingly good at.</p>
<p>Fast forward a few years and a few rewrites. The library has become a way to work with streaming data (files, IO, etc.) using
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator"><code>AsyncIterable</code></a>
instead of JavaScript streams for everything. You can use <code>map</code>, <code>filter</code>, <code>find</code>, and a whole bunch of other
methods just like you would on an <code>Array</code>, but they are streamed and lazy. Errors work the
way you expect them to. You can process through terrabytes of information while using very little memory.</p>
<p>It also lets you <code>run</code> child processes. Yeah, that part turned out really good. It's easy. It's almost trivial.
You can run processes concurrently. There is a little more boilerplate than Bash, you know, because it
uses Typescript syntax - but it is really minimal and easy to read. Deno has improved their process runner since the old days, but
this is still better.</p>
<!-- `proc` let's you use child processes with
[`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator)
instead of the streams API, and it includes a library of higher-order functions
for <code>AsyncIterator</code> via
<a href="https://deno.land/x/proc@0.22.1/mod.ts?s=Enumerable"><code>Enumerable</code></a> that
roughly matches what you can do with an array (<code>map</code>, <code>filter</code>, <code>find</code>), but for
asynchronous code.</p>
<p><code>proc</code> simplifies the process of converting a <code>bash</code> script into a Deno
for `AsyncIterator` via
[`Enumerable`](https://deno.land/x/proc@0.22.1/mod.ts?s=Enumerable) that
roughly matches what you can do with an array (`map`, `filter`, `find`), but for
asynchronous code. -->
<!-- `proc` simplifies the process of converting a `bash` script into a Deno
application. The intention is to make writing code that uses lots of IO and
child processes <em>almost</em> as easy as shell scripting, but you also get proper
error handling, type checking, and Deno's security-by-default.</p>
child processes _almost_ as easy as shell scripting, but you also get proper
error handling, type checking, and Deno's security-by-default. -->
<p><a href="https://deno.land/x/proc@0.22.1/mod.ts">Developer Documentation</a></p>
<h2 id="usage"><a class="header" href="#usage">Usage</a></h2>
<pre><code class="language-typescript">import { run } from "https://deno.land/x/proc@0.22.1/mod.ts";
Expand All @@ -211,13 +226,12 @@ <h2 id="a-better-example"><a class="header" href="#a-better-example">A Better Ex
</ul>
</li>
</ul>
<pre><code class="language-typescript">const [words1, words2] = read(
fromFileUrl(import.meta.resolve("./warandpeace.txt.gz")),
)
<pre><code class="language-typescript">const [words1, words2] =
read(fromFileUrl(import.meta.resolve("./warandpeace.txt.gz")))
.transform(gunzip)
.lines
.map((line) =&gt; line.toLocaleLowerCase())
.run({ buffer: true }, "grep", "-oE", "(\\w|')+")
.run("grep", "-oE", "(\\w|')+") // grep out the words to individual lines
.tee();

const [uniqueWords, totalWords] = await Promise.all([
Expand Down
38 changes: 26 additions & 12 deletions docs/print.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,32 @@ <h1 class="menu-title">proc</h1>
<div id="content" class="content">
<main>
<h1 id="proc-0221"><a class="header" href="#proc-0221"><code>proc 0.22.1</code></a></h1>
<p><code>proc</code> let's you use child processes with
<p>When I started this project, Deno was still young. My goal was to create a better way to run
child processes. I realized the Deno had the potential to be a better version of Bash scripting.
In its simplest form, a Deno script can run standalone, without external configuration or compilation.
A big selling point is the security-by-default, which is a problem for system admins who run Bash
scripts with <code>root</code> privileges.
However, the young Deno lacked a lightweight, fluent way to run child processes - something that Bash is exceedingly good at.</p>
<p>Fast forward a few years and a few rewrites. The library has become a way to work with streaming data (files, IO, etc.) using
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator"><code>AsyncIterable</code></a>
instead of JavaScript streams for everything. You can use <code>map</code>, <code>filter</code>, <code>find</code>, and a whole bunch of other
methods just like you would on an <code>Array</code>, but they are streamed and lazy. Errors work the
way you expect them to. You can process through terrabytes of information while using very little memory.</p>
<p>It also lets you <code>run</code> child processes. Yeah, that part turned out really good. It's easy. It's almost trivial.
You can run processes concurrently. There is a little more boilerplate than Bash, you know, because it
uses Typescript syntax - but it is really minimal and easy to read. Deno has improved their process runner since the old days, but
this is still better.</p>
<!-- `proc` let's you use child processes with
[`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator)
instead of the streams API, and it includes a library of higher-order functions
for <code>AsyncIterator</code> via
<a href="https://deno.land/x/proc@0.22.1/mod.ts?s=Enumerable"><code>Enumerable</code></a> that
roughly matches what you can do with an array (<code>map</code>, <code>filter</code>, <code>find</code>), but for
asynchronous code.</p>
<p><code>proc</code> simplifies the process of converting a <code>bash</code> script into a Deno
for `AsyncIterator` via
[`Enumerable`](https://deno.land/x/proc@0.22.1/mod.ts?s=Enumerable) that
roughly matches what you can do with an array (`map`, `filter`, `find`), but for
asynchronous code. -->
<!-- `proc` simplifies the process of converting a `bash` script into a Deno
application. The intention is to make writing code that uses lots of IO and
child processes <em>almost</em> as easy as shell scripting, but you also get proper
error handling, type checking, and Deno's security-by-default.</p>
child processes _almost_ as easy as shell scripting, but you also get proper
error handling, type checking, and Deno's security-by-default. -->
<p><a href="https://deno.land/x/proc@0.22.1/mod.ts">Developer Documentation</a></p>
<h2 id="usage"><a class="header" href="#usage">Usage</a></h2>
<pre><code class="language-typescript">import { run } from "https://deno.land/x/proc@0.22.1/mod.ts";
Expand All @@ -212,13 +227,12 @@ <h2 id="a-better-example"><a class="header" href="#a-better-example">A Better Ex
</ul>
</li>
</ul>
<pre><code class="language-typescript">const [words1, words2] = read(
fromFileUrl(import.meta.resolve("./warandpeace.txt.gz")),
)
<pre><code class="language-typescript">const [words1, words2] =
read(fromFileUrl(import.meta.resolve("./warandpeace.txt.gz")))
.transform(gunzip)
.lines
.map((line) =&gt; line.toLocaleLowerCase())
.run({ buffer: true }, "grep", "-oE", "(\\w|')+")
.run("grep", "-oE", "(\\w|')+") // grep out the words to individual lines
.tee();

const [uniqueWords, totalWords] = await Promise.all([
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/searchindex.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion site/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title = "proc"
create-missing = false

[preprocessor.mdbook-deno-script-preprocessor]
command = """deno --unstable run \
command = """deno run \
--allow-net=deno.land \
--allow-run=git \
../tools/mdbook-deno-script-preprocessor.ts \
Expand Down
35 changes: 27 additions & 8 deletions site/src/introduction.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,37 @@
# `proc {{gitv}}`

`proc` let's you use child processes with
When I started this project, Deno was still young. My goal was to create a better way to run
child processes. I realized the Deno had the potential to be a better version of Bash scripting.
In its simplest form, a Deno script can run standalone, without external configuration or compilation.
A big selling point is the security-by-default, which is a problem for system admins who run Bash
scripts with `root` privileges.
However, the young Deno lacked a lightweight, fluent way to run child processes - something that Bash is exceedingly good at.

Fast forward a few years and a few rewrites. The library has become a way to work with streaming data (files, IO, etc.) using
[`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator)
instead of JavaScript streams for everything. You can use `map`, `filter`, `find`, and a whole bunch of other
methods just like you would on an `Array`, but they are streamed and lazy. Errors work the
way you expect them to. You can process through terrabytes of information while using very little memory.

It also lets you `run` child processes. Yeah, that part turned out really good. It's easy. It's almost trivial.
You can run processes concurrently. There is a little more boilerplate than Bash, you know, because it
uses Typescript syntax - but it is really minimal and easy to read. Deno has improved their process runner since the old days, but
this is still better.



<!-- `proc` let's you use child processes with
[`AsyncIterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator)
instead of the streams API, and it includes a library of higher-order functions
for `AsyncIterator` via
[`Enumerable`](https://deno.land/x/proc@{{gitv}}/mod.ts?s=Enumerable) that
roughly matches what you can do with an array (`map`, `filter`, `find`), but for
asynchronous code.
asynchronous code. -->

`proc` simplifies the process of converting a `bash` script into a Deno
<!-- `proc` simplifies the process of converting a `bash` script into a Deno
application. The intention is to make writing code that uses lots of IO and
child processes _almost_ as easy as shell scripting, but you also get proper
error handling, type checking, and Deno's security-by-default.
error handling, type checking, and Deno's security-by-default. -->

[Developer Documentation](https://deno.land/x/proc@{{gitv}}/mod.ts)

Expand Down Expand Up @@ -47,13 +67,12 @@ Given the text for _War and Peace_:
- Use `sort` with `uniq` to count the unique words.

```typescript
const [words1, words2] = read(
fromFileUrl(import.meta.resolve("./warandpeace.txt.gz")),
)
const [words1, words2] =
read(fromFileUrl(import.meta.resolve("./warandpeace.txt.gz")))
.transform(gunzip)
.lines
.map((line) => line.toLocaleLowerCase())
.run({ buffer: true }, "grep", "-oE", "(\\w|')+")
.run("grep", "-oE", "(\\w|')+") // grep out the words to individual lines
.tee();

const [uniqueWords, totalWords] = await Promise.all([
Expand Down

0 comments on commit 8ff583a

Please sign in to comment.