ci(apidocs-drift): build index.cjs so typedoc can resolve wrapper imports#2163
Merged
Conversation
…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).
Deploying with
|
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
The
typescriptjob of the API Reference Drift guard now runspnpm run build:cjsafternapi build, soindex.cjs/index.d.ctsexist 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 emitsindex.js/index.d.ts), butwrapper.tsimports from./index.cjs. typedoc therefore failed with:The 4 implicit-any errors are a cascade from the single unresolved-module error — with
./index.cjsunresolved, every type flowing from the native module (e.g.result.stdout) collapses toany. The publishedbuildscript already handles this viabuild:cjs(renameindex.js→index.cjs, copyindex.d.ts→index.d.cts); the drift job just never ran it.Before / After
Reproduced locally (napi build +
build:cjs+node scripts/gen_ts_apidocs.mjs):[error] Found 5 errors and 0 warnings; typedoc exits non-zero, drift check never runs.typescript.mdis unchanged — no content drift, so this is purely a workflow fix.Risk
build:cjsscript.Checklist