fix(build): stop the declaration build from losing its own output - #374
Conversation
📝 WalkthroughWalkthroughThe package TypeScript build configurations now disable incremental compilation and remove explicit ChangesTypeScript build configuration
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Fixes local incremental declaration builds by caching TypeScript build metadata alongside generated declarations.
Changes:
- Adds
.build.tsbuildinfofiles to Turbo’sbuildoutputs. - Ensures cached declarations and their incremental state are restored together.
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
be268d1 to
abf4b5a
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/extensions/tanstack/tsconfig.build.json`:
- Around line 8-9: Remove the inherited tsBuildInfoFile setting from all nine
build configurations while retaining incremental: false and the existing dist/**
output: packages/extensions/tanstack/tsconfig.build.json (lines 8-9),
packages/extensions/terminal/tsconfig.build.json (lines 8-9),
packages/extensions/test-runner/tsconfig.build.json (lines 8-9),
packages/extensions/try-it/tsconfig.build.json (lines 8-9),
packages/extensions/whiteboard/tsconfig.build.json (lines 8-9),
packages/protocol/tsconfig.build.json (lines 9-10),
packages/solid-diffs/tsconfig.build.json (lines 8-9),
packages/solid-streamdown/tsconfig.build.json (lines 8-9), and
packages/ui-kit-chat-tools/tsconfig.build.json (lines 8-9).
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7654dcd1-d270-4c80-b59e-459ef5258bfb
📒 Files selected for processing (18)
packages/embed/tsconfig.build.jsonpackages/extensions/ios/tsconfig.build.jsonpackages/extensions/page/tsconfig.build.jsonpackages/extensions/recorder/tsconfig.build.jsonpackages/extensions/tanstack/tsconfig.build.jsonpackages/extensions/terminal/tsconfig.build.jsonpackages/extensions/test-runner/tsconfig.build.jsonpackages/extensions/try-it/tsconfig.build.jsonpackages/extensions/whiteboard/tsconfig.build.jsonpackages/protocol/tsconfig.build.jsonpackages/solid-diffs/tsconfig.build.jsonpackages/solid-streamdown/tsconfig.build.jsonpackages/ui-kit-chat-tools/tsconfig.build.jsonpackages/ui-kit-chat/tsconfig.build.jsonpackages/ui-kit-system/tsconfig.build.jsonpackages/ui-kit-tap/tsconfig.build.jsonpackages/ui-kit-terminal/tsconfig.build.jsonpackages/uno-preset/tsconfig.build.json
…ibes tsc --incremental trusts .build.tsbuildinfo and never checks whether its outputs still exist, so once the buildinfo and dist disagree it exits 0 and emits no .d.ts. The build task declared only dist/** as output, leaving .build.tsbuildinfo outside turbo's knowledge while dist was cached, restored and cleaned independently. Every consumer then failed with TS7016. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Every package builds with `vite build && tsc -p tsconfig.build.json`. vite empties dist, deleting the .d.ts tsc emitted last time; tsc then reads the buildinfo, sees an unchanged source graph, and skips emit without checking whether its outputs still exist. Every second build dropped all declarations and consumers failed with TS7016. Incremental state is only safe when one tool owns the outDir, so it stays on for typecheck (tsc --noEmit, nothing else writes there) and comes off for the declaration build. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
abf4b5a to
620af69
Compare
Fixes a regression from #372 that is currently on
mainand breaks local builds and the packed-tgz e2e.Mechanism
Every package builds with
vite build && tsc -p tsconfig.build.json.vite buildemptiesdist/, deleting the.d.tsfiles tsc emitted on the previous run.tscthen reads the.build.tsbuildinfochore(build): make typecheck cacheable and incremental #372 introduced, sees an unchanged source graph, and correctly concludes it has already emitted — so it writes nothing. TypeScript never checks whether its outputs still exist on disk.Every second build silently loses all declarations. No turbo cache is involved; it happens inside a single
pnpm run build.Consumers then fail with
TS7016: Could not find a declaration file for module '@conciv/…', which is what brokeui-kit-terminal,ui-kit-chat,extension-terminalandembed, and why the packed-tgz Next.js e2e went red onmainat9397c6e0(that test installs real packed artifacts).Measured
@conciv/protocol, same sources, two consecutive builds, before the fix:After the fix, the whole
@conciv/embeddependency chain built twice:The change
Incremental state is only safe when a single tool owns the
outDir. So it stays on for typecheck (tsc --noEmit, nothing else writes there — that is the caching #372 wanted, and it works) and comes off for the declaration build: 18tsconfig.build.jsonfiles get"incremental": falseand droptsBuildInfoFile.turbo.jsonis unchanged frommain— an earlier revision of this PR added.build.tsbuildinfoto the build task's outputs, which only made cache restores consistent and did not fix the underlying loss. That is reverted.Gates:
format:checkclean, typecheck green,fallow audit --changed-since mainverdictpass.🤖 Generated with Claude Code
Summary by CodeRabbit