Repository navigation
fix(dev): make the demo app type-check and build - #69
Merged
Merged
Conversation
- dev/payload.config.ts: typescript.declare false, so the generated types no longer narrow Payload's collection slugs for the plugin source that the demo app compiles; autoGenerate false. - dev/tsconfig.json: map @xtr-dev/payload-feature-flags/* to src, so the admin import map resolves without a built dist/. - typescript 5.7.3 -> 5.9.3 (dev): Next's generated route validator is a CommonJS file importing the ESM routes, which 5.7 rejects under NodeNext. - Demo home page is rendered per request; prerendering it queried a database without tables during next build. - Two spec files typed correctly without the module augmentation. - New dev:build script, run in CI. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0122PV8TJ7ELGdAX7H2hdrRU
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
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.
next build devandtsc -p dev/tsconfig.jsonboth failed. Nothing undersrc/changes; the emitted.d.tsfiles are byte-identical before and after the TypeScript update.What was wrong, and the fix
dev/payload-types.tsended in adeclare module 'payload'block. It narrowed Payload's collection slugs for the whole program, including the plugin source the demo app compiles, which is written against any config (errors insrc/hooks/server.tsandsrc/endpoints/publicFlags.ts). The dev config now setstypescript.declare: false, andautoGenerate: false.dev/int.spec.tsrelied on that augmentation for one assignment. It now casts the result to the generated document type and assigns that toFeatureFlagDocument, so the compile-time check stays.dev/cache.spec.tswrapped a generic function invi.fn(), which drops the type parameter..next/types/validator.tsas a CommonJS file that doestypeof import()of the ESM routes. TypeScript 5.7 rejects that under NodeNext (TS1542); 5.8+ accepts it. TypeScript goes from 5.7.3 to 5.9.3 (devDependency).@xtr-dev/payload-feature-flags/views, which resolved throughexportstodist/, so the demo app only compiled afterpnpm build.dev/tsconfig.jsonnow maps the package name tosrc.next buildqueried a database with no tables. It is nowforce-dynamic, which also fits a page that shows current flag state.CI
New
pnpm dev:buildscript and CI step, so the demo app's compile and type check run on every PR.Checked locally
pnpm lint(0 errors),tsc --noEmit,tsc -p dev/tsconfig.json,pnpm test(95 passed, no type errors),pnpm build,pnpm dev:buildfrom a checkout withoutdist/, andnext dev:/admin,/and the public evaluate endpoint answer 200.Not covered: the Playwright e2e suite still does not run in CI.
🤖 Generated with Claude Code
https://claude.ai/code/session_0122PV8TJ7ELGdAX7H2hdrRU