Skip to content

docs: rewrite README to reference-grade - #13

Merged
rohanpoudel2 merged 3 commits into
mainfrom
docs/readme-overhaul
Aug 5, 2026
Merged

docs: rewrite README to reference-grade#13
rohanpoudel2 merged 3 commits into
mainfrom
docs/readme-overhaul

Conversation

@rohanpoudel2

Copy link
Copy Markdown
Owner

What

Rewrites README.md into a proper reference. No source changes, no version bump — the README ships in files, so it reaches npm on the next publish either way.

Why

The old README explained the tool well but was structured as a feature tour. It had no badges, no navigation, an API section that showed a single example without naming the exported surface, and nothing to help someone who has just hit an error.

Changes

  • Badges + npx quick start — npm version, downloads, CI, node, types, license. The first thing a reader can do is run it without installing.
  • Table of contents — the page is now long enough to need one.
  • Complete CLI reference — every flag with its real default, split into shared / image / video, plus why concurrency differs per media kind (min(cores, 8) for images, cores / 4 for video).
  • Complete Node API reference — every exported function, options tables with defaults, the JobResult union, type guards, progress events, cancellation, and the rationale for branded Quality / Pixels.
  • Recipes — build script, CI size gate, capability probe before offering a format.
  • FAQ — the questions this design provokes: why a file was reported "skipped", where output went, FFMPEG_NOT_FOUND while ffmpeg is installed, why .webm rejects H.264, why .avif / .jxl may be missing, whether it works when piped.
  • v1 comparison moved down and folded into the migration section, since it matters to existing users rather than to someone evaluating the package.

Two corrections

The previous README had these wrong:

  1. Images already in a modern format are preserved, not forced to WebP — an .avif input stays AVIF (resolveImageFormat, src/core/compress.ts:248).
  2. formats prints the ffmpeg version; only formats --json carries the resolved path, in video.ffmpeg.

Verification

Nothing here was written from memory:

  • The demo block is real output from imgvidcompress samples --recursive captured under a pty.
  • The JSON sample is a real --json run, including the kind field the old sample omitted.
  • Capability numbers (184 muxers, ~100 video encoders) came from formats --json on a stock Homebrew ffmpeg.
  • Every TypeScript example compiles under strict against dist/index.d.ts.
  • Every jq one-liner was executed, including the CI size gate — it correctly exits 1 on an oversized asset.
  • prettier --check README.md passes.

The README covered the tool but read as a feature tour: no badges, no
navigation, an API section that showed one example and named none of the
exported surface, and nothing for someone hitting an error at 2am.

- Badges (npm, downloads, CI, node, types, license) and an npx quick start,
  so the first thing a reader can do is run it without installing.
- Table of contents; the page is now long enough to need one.
- Complete CLI reference: every flag with its real default, split into
  shared/image/video, plus the per-kind concurrency rationale.
- Complete Node API reference: every exported function, the options tables,
  the JobResult union, type guards, progress events, cancellation, and why
  quality/pixels are branded.
- Recipes for the cases people actually have — build script, CI size gate,
  capability probe before offering a format.
- FAQ covering the questions the design provokes: why a file was "skipped",
  where output went, FFMPEG_NOT_FOUND with ffmpeg installed, why webm
  rejects H.264, missing .avif/.jxl.
- v1 comparison moved below the useful content and folded into migration.

Everything here was verified against the source or a real run rather than
written from memory. Two claims the old README got wrong are fixed: images
already in a modern format keep it instead of being forced to WebP, and
`formats` prints the ffmpeg version while only `--json` carries the path.
The demo block, JSON sample, and capability numbers are real output. All
TypeScript examples typecheck under strict mode against dist/index.d.ts,
and the jq one-liners were executed.

Docs only — no version bump, no source changes.
CI runs `prettier --check .`, which covers markdown tables and fenced
TypeScript blocks. Table padding is normalised and the code samples are
reflowed to prettier's output.

The JobResult union is now shown as the real source definition — three
named payload types — with the per-status fields in a table, rather than
the inlined shape prettier expanded to twelve lines. Same information,
and it matches src/types/results.ts.

Examples re-checked with tsc after reflowing; still clean under strict.
@rohanpoudel2
rohanpoudel2 merged commit cf743a9 into main Aug 5, 2026
8 checks passed
This was referenced Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant