Repository navigation
docs: host documentation on GitHub Pages with VitePress - #234
Conversation
Move README content into a proper documentation site built with VitePress and deployed to https://yao-pkg.github.io/pkg/ via GitHub Actions. - Landing page with pkg identity (amber/pink palette from logo) - Guide split into 21 focused pages (getting started, targets, config, bytecode, compression, SEA mode, snapshot FS, native addons, ESM, API, troubleshooting, advanced) - New SEA vs Standard page highlighting the stock-binary benefit and linking the pkg-fetch elimination roadmap (#231) - DEVELOPMENT.md and docs/ARCHITECTURE.md canonical sources moved into docs-site/, roots replaced with stub pointers to avoid drift - README trimmed to install + quick start + links to hosted docs - .github/workflows/docs.yml builds and deploys on push to main Manual follow-up: enable GitHub Pages with Source = GitHub Actions in repo settings. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…-node, and deploy-pages
- gate docs workflow on PRs (build-only) to catch VitePress breakage before merge - switch workflow to npm ci with cache-dependency-path for reproducible installs - read site version from package.json so nav dropdown no longer rots each release - reconcile SEA vs Standard messaging on the guide landing page - fix typos and stale DEVELOPMENT.md references in copilot-instructions - mark root DEVELOPMENT.md and docs/ARCHITECTURE.md stubs as non-canonical - replace non-standard -webkit-linear-gradient with standard linear-gradient Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR migrates repository documentation into a VitePress site and adds a GitHub Actions workflow to deploy it to GitHub Pages, while trimming the root README and replacing root docs with canonical stubs.
Changes:
- Add a new
docs-site/VitePress documentation site (landing page, guides, architecture, development docs, theme + config). - Add a GitHub Actions workflow to build and deploy the docs site to GitHub Pages.
- Replace root
README.md,DEVELOPMENT.md, anddocs/ARCHITECTURE.mdwith pointers to the hosted docs / canonical sources.
Reviewed changes
Copilot reviewed 35 out of 37 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/ARCHITECTURE.md | Replaced full architecture doc with a stub pointing to the canonical docs-site page. |
| docs-site/package.json | Adds a private package definition and VitePress scripts/dependency for the docs site. |
| docs-site/index.md | Adds a VitePress home/landing page with hero content and quick-start. |
| docs-site/guide/troubleshooting.md | Introduces a troubleshooting guide page with common runtime/build errors. |
| docs-site/guide/targets.md | Adds a targets/cross-compilation guide page. |
| docs-site/guide/snapshot-fs.md | Adds snapshot filesystem behavior and path mapping documentation. |
| docs-site/guide/sea-vs-standard.md | Adds SEA vs Standard positioning, feature matrix, and pkg-fetch roadmap page. |
| docs-site/guide/sea-mode.md | Adds SEA mode usage docs (simple vs enhanced) and trade-offs. |
| docs-site/guide/packaged-app.md | Adds a short guide for packaged-app CLI equivalence and references. |
| docs-site/guide/output.md | Documents output flags and debugging behavior. |
| docs-site/guide/options.md | Documents --options for baking Node/V8 runtime options. |
| docs-site/guide/native-addons.md | Documents native addon handling and cache configuration. |
| docs-site/guide/index.md | Adds the guide index/intro page (“What is pkg?”). |
| docs-site/guide/getting-started.md | Adds installation + CLI reference + examples page. |
| docs-site/guide/esm.md | Adds ESM support documentation and SEA-related note. |
| docs-site/guide/environment.md | Documents supported environment variables and examples. |
| docs-site/guide/detecting-assets.md | Documents asset auto-detection heuristics. |
| docs-site/guide/custom-node.md | Documents using a custom Node binary via env var. |
| docs-site/guide/configuration.md | Documents pkg config (scripts, assets, ignore) with examples. |
| docs-site/guide/compression.md | Documents compression flags and SEA-mode limitation. |
| docs-site/guide/bytecode.md | Documents bytecode behavior, reproducibility, and public-packages constraints. |
| docs-site/guide/build.md | Documents building base binaries from source and points to SEA direction. |
| docs-site/guide/api.md | Documents the pkg programmatic API usage. |
| docs-site/guide/advanced-windows-metadata.md | Adds advanced guide on post-processing Windows metadata with resedit. |
| docs-site/guide/advanced-debug-vfs.md | Adds advanced debugging guide for inspecting the virtual filesystem. |
| docs-site/development.md | Moves development/release/testing docs into docs site. |
| docs-site/architecture.md | Moves full architecture doc into docs site as canonical source. |
| docs-site/.vitepress/theme/index.ts | Adds theme entry importing custom CSS. |
| docs-site/.vitepress/theme/custom.css | Adds custom brand styling variables and hero image tweaks. |
| docs-site/.vitepress/config.ts | Adds VitePress site configuration (base, nav, sidebar, edit links, SEO/meta). |
| docs-site/.gitignore | Ignores docs-site build output and caches. |
| README.md | Trims README to quick start + links to the hosted docs. |
| DEVELOPMENT.md | Replaces root development doc with a stub pointing to docs-site. |
| .github/workflows/docs.yml | Adds build + deploy workflow for GitHub Pages using GitHub Actions. |
| .github/copilot-instructions.md | Updates contributor guidance to use docs-site/ as the canonical docs source. |
Files not reviewed (1)
- docs-site/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)
docs-site/guide/targets.md:1
- There’s an extra comma before the parenthesized platform, which reads like a punctuation mistake. Consider removing it for clarity.
New pages: - guide/migration.md — drop-in migration from archived vercel/pkg fork - guide/recipes.md — copy-paste cookbook for common tasks - changelog.md — CHANGELOG.md mirrored into the docs site via include Rewritten pages: - guide/getting-started.md — first-binary tutorial with code groups + full CLI table; no more raw --help dump - guide/sea-mode.md — leads with a hello-world walkthrough - guide/configuration.md — full schema table + production example - guide/targets.md — code groups + tip callout + alpine/musl section - guide/environment.md — inlined pkg-fetch vars + PKG_EXECPATH clarification - guide/troubleshooting.md — NODE_OPTIONS dead end replaced with a full fix, check-this-first preface added - guide/bytecode|compression|options|build|output|snapshot-fs|native-addons| esm|api|packaged-app|custom-node|detecting-assets|advanced-debug-vfs| advanced-windows-metadata — expanded + frontmatter + next-step links VitePress config: - withMermaid for mermaid flowchart support - sitemap.hostname for SEO - outline level raised to [2, 4] - Collapsed singleton sidebar groups into a Cookbook section - Added Recipes to the top nav - Version dropdown links to migration + changelog Landing page: - vercel/pkg fork banner - Social badges (npm version, downloads, stars, CI, license) - Code groups for CLI vs package.json vs Node.js API - Standard vs SEA side-by-side Architecture: - Top-level mermaid overview comparing both build paths - Mermaid flowcharts for traditional + SEA build pipelines - Mermaid flow for VFS provider path resolution - ASCII diagrams kept for readers who prefer them Development page: - Full docs-site local dev workflow - Structure, mermaid how-to, new-page checklist - Canonical-source note for the root stubs Polish: - Responsive hero image on small viewports - Fork-banner CSS - .nvmrc pinning docs-site to Node 22 - Frontmatter (title + description) on every guide page for SEO - Twitter card meta Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Record a real 15s pkg session (mkdir → echo → pkg index.js → ls → run) with VHS as docs-site/public/hero.gif (98KB). Tape-based so it is reproducible in CI if we want to regenerate it later. - Embed the GIF in the landing page as a figure under the fork banner. - Replace the inline HTML badge anchors with Markdown image links on a single line so VitePress renders them inside a single <p>. The old setup put each anchor on its own line which the markdown processor wrapped in separate paragraphs, stacking the badges vertically. - Add .landing-badges / .landing-demo / .landing-body CSS: flex layout for the badge row, shadow + border-radius on the demo GIF, consistent max-width + padding on the content block. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The previous recording ran VHS with a PATH that did not include the nvm node bin dir, so the /tmp/bin/pkg wrapper's `env ... node ...` invocation failed with "env: node: No such file or directory" and the session showed three cascading errors instead of a successful build. Fix: hardcode the absolute node path inside the wrapper so it works under any restricted PATH. Re-recorded — now shows the real pkg build producing three binaries and running the linux one. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… SEA mode documentation
Audience split: keep the detailed pipelines, binary layouts, VFS provider, worker bootstrap and patch tables as docs/ARCHITECTURE.md (contributor / agent reference), and replace docs-site/architecture.md with a lean ~110 line user overview that links back to it. Also dedup SEA-vs-standard and walker explanations across index pages, collapse the pkg-fetch roadmap down to a pointer to #231, share the reference sidebar config, and add a jump TOC to the recipes page. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Standard cross-compile is confirmed broken on Node 22 targets (builds succeed but linux-arm64 crashes with UNEXPECTED-20 and win-x64 exits silently, matching #87 and #181). Node 20 and Node 24 are fine in both Standard and Enhanced SEA modes. Rewrite the targets.md Cross-compilation section as a node-version-keyed support table with the regression called out, and reference it from the landing page, getting-started, and the sea-vs-standard feature matrix. Verified on a Linux x86_64 host against linux-x64, linux-arm64 (via docker + QEMU) and win-x64 (via docker + Wine) for each of Node 20, 22, and 24 using the pkg-xcompile-test harness. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Project-local skill (under .claude/skills/) that runs a full (mode × target) cross-compile matrix for pkg and reports which combinations work. Default modes are std, std-public (--public-packages "*" --public) and sea; targets cover linux-x64, linux-arm64 (via docker + QEMU), win-x64 (via docker + Wine), and macos-* (build only — runtime verification needs a real Mac). The run-matrix.sh script auto-switches nvm to match the target node major, resolves PKG_BIN from its own location (<repo>/lib-es5/bin.js), and writes binaries to $PKG_XCOMPILE_WORKDIR (default /tmp/pkg-xcompile) so the working tree stays clean. SKILL.md records the known results for node 20/22/24 as of 2026-04-15 and documents the wine-in-docker stdout gotcha. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a GitHub Actions workflow that builds hello.js from every supported
host runner (linux-x64, linux-arm64, macos-x64, macos-arm64, win-x64)
for every target triple, in Standard / Standard+public / SEA modes on
Node 22. Each produced binary is then executed on its target runner,
and a per-mode matrix of the host-to-target results is posted as a
sticky PR comment.
Structured as three stages:
1. build — matrix of (host × mode × node); each job compiles all
targets from that host and uploads the binaries.
2. run — one job per target runner; downloads all artifacts,
filters by target, runs each binary, writes result JSON.
3. collate — renders the markdown matrix and upserts it as a PR
comment using a <!-- xcompile-matrix --> marker so
re-runs update instead of spamming.
Build failures are emitted as ".failed" sentinel files so the run
stage can distinguish BUILD_FAIL from RUN_FAIL. Uses yarn (the repo's
package manager) and pins actions to the versions already used
elsewhere in the repo (checkout@v6, setup-node@v6, upload/download-
artifact@v4, github-script@v7).
Triggers on PRs touching lib/, prelude/, dictionary/, scripts/,
package.json, yarn.lock, or the workflow itself, and on
workflow_dispatch for manual runs.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cross-compile matrixEach cell: the hello.js binary was built on the row host and executed on the column target runner. Commit: Legend: ✅ runs · ❌ build build failed · ❌ run built but crashed on target · ❔ missing Node 22 —
|
| host \ target | linux-x64 | linux-arm64 | macos-x64 | macos-arm64 | win-x64 |
|---|---|---|---|---|---|
| linux-x64 | ✅ | ❌ run | ❔ | ❌ run | ❌ run |
| linux-arm64 | ❌ run | ✅ | ❔ | ❌ run | ❌ run |
| macos-x64 | ❔ | ❔ | ❔ | ❔ | ❔ |
| macos-arm64 | ❔ | ❔ | ❔ | ❔ | ❔ |
| win-x64 | ❌ run | ❌ build | ❔ | ❌ build | ✅ |
Node 22 — std-public
| host \ target | linux-x64 | linux-arm64 | macos-x64 | macos-arm64 | win-x64 |
|---|---|---|---|---|---|
| linux-x64 | ✅ | ✅ | ❔ | ✅ | ✅ |
| linux-arm64 | ✅ | ✅ | ❔ | ✅ | ✅ |
| macos-x64 | ❔ | ❔ | ❔ | ❔ | ❔ |
| macos-arm64 | ✅ | ✅ | ❔ | ✅ | ✅ |
| win-x64 | ✅ | ❌ build | ❔ | ❌ build | ✅ |
Node 22 — sea
| host \ target | linux-x64 | linux-arm64 | macos-x64 | macos-arm64 | win-x64 |
|---|---|---|---|---|---|
| linux-x64 | ✅ | ✅ | ❔ | ✅ | ✅ |
| linux-arm64 | ✅ | ✅ | ❔ | ✅ | ✅ |
| macos-x64 | ❔ | ❔ | ❔ | ❔ | ❔ |
| macos-arm64 | ✅ | ✅ | ❔ | ✅ | ✅ |
| win-x64 | ✅ | ✅ | ❔ | ✅ | ✅ |
Failure details
- linux-arm64|std|n22 → linux-x64 (RUN_FAIL):
pkg/prelude/bootstrap.js:354 if (error) throw error; ^ Error: UNEXPECTED-20 at readFileFromSnapshot (pkg/prelude/bootstrap.js:971:16) at Object.readFileSync (pkg/prelude/bootstrap. - win-x64|std|n22 → linux-x64 (RUN_FAIL):
exit 4 - linux-x64|std|n22 → linux-arm64 (RUN_FAIL):
pkg/prelude/bootstrap.js:354 if (error) throw error; ^ Error: UNEXPECTED-20 at readFileFromSnapshot (pkg/prelude/bootstrap.js:971:16) at Object.readFileSync (pkg/prelude/bootstrap. - linux-arm64|std|n22 → macos-arm64 (RUN_FAIL):
exit 4 - linux-x64|std|n22 → macos-arm64 (RUN_FAIL):
pkg/prelude/bootstrap.js:354 if (error) throw error; ^ Error: UNEXPECTED-20 at readFileFromSnapshot (pkg/prelude/bootstrap.js:971:16) at Object.readFileSync (pkg/prelude/bootstrap. - linux-arm64|std|n22 → win-x64 (RUN_FAIL):
pkg/prelude/bootstrap.js:354 if (error) throw error; ^ Error: UNEXPECTED-20 at readFileFromSnapshot (pkg/prelude/bootstrap.js:971:16) at Object.readFileSync (pkg/prelude/bootstrap. - linux-x64|std|n22 → win-x64 (RUN_FAIL):
exit 4
- docs: fix broken cross-page anchors in bytecode, recipes, build and sea-mode guides; replace raw /pkg/ prefixed link in index.md with VitePress-managed markdown link. - ci(xcompile): switch cross-compile matrix to workflow_dispatch only (manual trigger is safer and avoids burning macOS/Windows minutes on every PR), wire the node-majors input via a setup job, add timeouts, upload per-cell build logs, short-circuit collate when no results, fix empty-array expansion under bash 3.2 / set -u on macOS runners, add spawnSync timeout, sanitise backticks in PR summary, and drop the dead PR-comment path. - ci(docs): split concurrency so PR builds no longer queue behind production deploys, scope pages/id-token permissions to the deploy job, add timeout-minutes, and add an offline lychee link-check step to catch dead anchors before they ship. - chore(skills): make run-matrix.sh fail fast (set -euo pipefail), write per-cell logs under $WORKDIR/logs so a failing cell is not overwritten, print log paths on stderr, add an unknown-target case, and document the debugging workflow in SKILL.md. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
package-lock.json was created by accident in #229 alongside the yarn lockfile. pkg's canonical package manager is yarn (see yarn.lock); the accidental npm lockfile drifts silently and confuses contributors. - Remove package-lock.json and gitignore it at the repo root so it cannot reappear. - Rewrite the dev-command references in CLAUDE.md, .claude/rules/*, .github/copilot-instructions.md and docs-site/development.md from "npm run <x>" to "yarn <x>", and spell out the split: pkg uses yarn, docs-site is the only place npm is used. User-facing install instructions (README, guide/getting-started, guide/ migration, guide/api) are unchanged — end users still "npm install -g @yao-pkg/pkg" and the CI recipe example still shows npm, since that reflects how consumers package their own projects. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
First run of the matrix on #234 surfaced three harness bugs (all cells that failed under Standard mode were already matching the known Node 22 regression — those were expected). The CI-side bugs were: 1. macos-arm64 std jobs died on the first target with `EXTRA[@]: unbound variable`. Bash 3.2 ships on GitHub's macOS runners, and `set -u` + `"${EMPTY_ARRAY[@]}"` is a nounset error there. std-public/sea worked only because EXTRA was non-empty. Expand it with `${EXTRA[@]+"${EXTRA[@]}"}` instead, which degrades gracefully on old bash. 2. All macos-x64 build and run jobs were cancelled by the runner pool — GitHub has retired the Intel macOS runner (macos-13). Drop macos-x64 as a build host entirely, and route the macos-x64 *target* runs to macos-14, which pre-installs Rosetta 2 and executes x86_64 Mach-O binaries transparently. 3. The run-stage reader iterated binaries and skipped .failed sidecars, so a pkg failure that left no output at all (vs. a 0-byte stub) dropped the combo out of the matrix as `:grey_question:` instead of showing `:x: build`. Also capture pkg's real exit code via `|| status=$?` so `set -e` doesn't eat it, always leave an empty binary on failure so the reader enumerates every combo, and pull the last 5 lines of the build log into the BUILD_FAIL detail so the collated summary surfaces the actual error without downloading artifacts. Verified by parsing the workflow YAML: 4 build hosts (linux-x64, linux-arm64, macos-arm64, win-x64), 5 run targets including macos-x64@macos-14. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The step was a belt-and-braces defence against dead anchors, but lychee fights VitePress's /pkg/ base-URL rewrite and extensionless URLs — it reports ~2000 false positives for resources that are served fine on the live site. Not worth the complexity; VitePress's own build-time dead-link check already catches markdown link typos, and the five broken anchors that motivated the step have been fixed and are verified against the rendered HTML. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Address Copilot review feedback on grammar in docs-site/development.md: fix "create release", "have build", "runned", "It install", and "Foreach" phrases flagged by the reviewer.
Add a `changes` job that uses dorny/paths-filter to detect whether anything outside docs-site/ was touched. The build matrix and every test.yml call still run so their required status check contexts are reported, but their steps are gated on the flag — docs-only PRs get green checks in seconds instead of burning the full OS/node matrix.
Summary
pkg-fetchelimination roadmap (Upstream pkg-fetch patches to Node.js core to eliminate custom binaries #231)DEVELOPMENT.mdanddocs/ARCHITECTURE.mdcanonical sources moved intodocs-site/, root files replaced with stub pointers so there's a single source of truthManual follow-up
After merge, enable GitHub Pages in repo settings:
Settings → Pages → Source: GitHub Actions
The workflow at
.github/workflows/docs.ymlwill deploy on every push tomainthat touchesdocs-site/.Test plan
npm run docs:buildinsidedocs-site/— clean build, zero warningsFiles
docs-site/— new VitePress site.github/workflows/docs.yml— build + deploy workflowREADME.md— trimmedDEVELOPMENT.md,docs/ARCHITECTURE.md— stub redirects🤖 Generated with Claude Code