Skip to content

ci(apidocs-drift): build index.cjs so typedoc can resolve wrapper imports#2163

Merged
chaliy merged 1 commit into
mainfrom
claude/friendly-einstein-9477v4
Jul 13, 2026
Merged

ci(apidocs-drift): build index.cjs so typedoc can resolve wrapper imports#2163
chaliy merged 1 commit into
mainfrom
claude/friendly-einstein-9477v4

Conversation

@chaliy

@chaliy chaliy commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

What changed

The typescript job of the API Reference Drift guard now runs pnpm run build:cjs after napi build, so index.cjs / index.d.cts exist before typedoc runs.

Why

After #2159 unblocked pnpm setup, the re-dispatched run exposed the real failure: the job ran only napi build --platform (which emits index.js / index.d.ts), but wrapper.ts imports from ./index.cjs. typedoc therefore failed with:

wrapper.ts:15:8 - error TS2307: Cannot find module './index.cjs' or its corresponding type declarations.
wrapper.ts:1236:13 - error TS7006: Parameter 's' implicitly has an 'any' type.
... (4 implicit-any errors)
[error] Found 5 errors and 0 warnings

The 4 implicit-any errors are a cascade from the single unresolved-module error — with ./index.cjs unresolved, every type flowing from the native module (e.g. result.stdout) collapses to any. The published build script already handles this via build:cjs (rename index.jsindex.cjs, copy index.d.tsindex.d.cts); the drift job just never ran it.

Before / After

Reproduced locally (napi build + build:cjs + node scripts/gen_ts_apidocs.mjs):

  • Before: [error] Found 5 errors and 0 warnings; typedoc exits non-zero, drift check never runs.
  • After:
    [info] json generated at /tmp/.../api.json
    [warning] Found 0 errors and 5 warnings
    wrote site/src/content/apidocs/typescript.md (52849 bytes)
    
    0 errors, and the committed typescript.md is unchanged — no content drift, so this is purely a workflow fix.

Risk

  • Low
  • CI-only YAML change; reuses the existing build:cjs script.

Checklist

  • Tests added or updated — N/A (CI workflow config only)
  • Backward compatibility considered — N/A (internal automation)

…orts

The typescript drift job ran only `napi build --platform`, which emits
index.js / index.d.ts. wrapper.ts imports from ./index.cjs, so typedoc
failed with TS2307 (cannot find module './index.cjs') and every type
flowing from the native module collapsed to `any`, yielding 5 spurious
errors (1 TS2307 + 4 implicit-any) before the drift check could run.

Run the existing `build:cjs` script after the napi build (renames
index.js->index.cjs, copies index.d.ts->index.d.cts), mirroring the
published `build`. Verified locally: typedoc now reports 0 errors and
the committed typescript.md is already up to date (no content drift).
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 11379e4 Commit Preview URL

Branch Preview URL
Jul 13 2026, 09:43 AM

@chaliy chaliy merged commit 5a55ddb into main Jul 13, 2026
19 checks passed
@chaliy chaliy deleted the claude/friendly-einstein-9477v4 branch July 13, 2026 09:53
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