Different pipes. One standard.

Type to search this site.

Search runs in your browser against a static index built with this site (Pagefind). Nothing you type is sent to a server.

How do I ship a pipe as an npm package?

Available — v0.0.1 (experimental)javascript

An npm package that is a pipe

Add a manifest and one line to package.json. The code stays an ordinary Node.js script that reads stdin and writes stdout.

Available in v0.0.1: the files, README and tests are in examples/npm-package of the openflange-go repository. Commands run from the repository root.

Needs: Node.js 18 or newer. No dependencies, nothing to install.

A pipe is a data-processing step with declared inputs and outputs.

What goes in, what comes out

Input (stdin)
"Hello, World!"
"Crème Brûlée"
Command
printf '%s\n' '"Hello, World!"' '"Crème Brûlée"' | openflange run ./examples/npm-package --grant subprocess
Output (stdout)
"hello-world"
"creme-brulee"

Files and further commands

examples/npm-package/package.json
{
  "name": "@openflange-examples/slugify",
  "version": "0.1.0",
  "description": "OpenFlange example pipe: turns strings into URL slugs.",
  "license": "Apache-2.0",
  "private": true,
  "bin": { "openflange-slugify": "slugify.js" },
  "files": ["slugify.js", "OPENFLANGE.md", "tests"],
  "engines": { "node": ">=18" },
  "openflange": { "manifest": "OPENFLANGE.md" }
}
Without the runner it is just a Node.js filter
printf '%s\n' '"Hello, World!"' '"Crème Brûlée"' | node examples/npm-package/slugify.js

What to notice

  • Three files: slugify.js (line in, line out, no dependencies), OPENFLANGE.md (the contract: input text, output slug) and package.json, which points at the manifest.
  • The package is marked "private": true and is not published to npm; it is a local example.
  • A non-string item fails the run (E_RUNTIME). Permissions: subprocess, because the runner starts node.