Skip to content

fix: generate route types from the live route configuration - #1442

Open
fhammerschmidt wants to merge 1 commit into
rescript-lang:masterfrom
fhammerschmidt:fix/1421-route-types
Open

fhammerschmidt wants to merge 1 commit into
rescript-lang:masterfrom
fhammerschmidt:fix/1421-route-types

Conversation

@fhammerschmidt

@fhammerschmidt fhammerschmidt commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

The route-type generator imported a missing app/routes.mjs and wrote to the old src/Path.res location. The shared route union was maintained manually, omitted live pages, and still accepted deleted paths and /undefined.

  • Move the build-time route table from DocsRoutes.res into apps/docs/route-config.mjs, consumed by React Router, prerender configuration, and route-type generation. Native Node loading removes the ReScript compilation bootstrap dependency and makes paths independent of the working directory.
  • Generate packages/shared/src/Path.res from the nested route tree, including index pages, MDX pages, and API modules. Deduplicate and sort concrete URLs; omit layout-only entries, parameters, and catch-all patterns.
  • Add the six missing routes and remove /undefined, six deleted syntax pages, and /*. Most of the generated-file diff is deterministic sorting.
  • Generate types before root, docs, and guide ReScript builds and when starting the ReScript watcher. Document yarn build:routes and the non-writing yarn check:routes.
  • Reject stale generated types in CI and add seven Node regression tests for nested layouts, content/API changes, deterministic output, non-writing checks, and CLI use from another working directory.

Targets website master (v12), on fix/1421-route-types. No compiler repository changes.

Compatibility: #1432 also changes the API route source. That PR now integrates this configuration and retains published v12 API-data selection. Merge this PR before #1432.

Validation:

Fixes #1408.
Part of #1421.

Move the build-time route table to native JavaScript so React Router and route generation share one configuration without requiring compiled ReScript first.

Generate the shared Path.res before compilation, handle nested layouts and index routes, omit URL patterns, and detect stale output in CI. Add regression tests for content discovery, deterministic output, and non-writing checks from any working directory.

Fixes rescript-lang#1408.

Part of rescript-lang#1421.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T22:56:53.331246Z ace5010 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

fhammerschmidt added a commit to fhammerschmidt/rescript-lang.org that referenced this pull request Oct 9, 2026
Integrate rescript-lang#1442, keep API routes on the published v12 dataset, and regenerate Path.res from that dataset. Remove the superseded ReScript route table without restoring legacy API JSON.

Merge rescript-lang#1442 before this PR.

Fixes rescript-lang#1391.

Part of rescript-lang#1421.

This branch has not been deployed

No deployments
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.

Route type Path.res is hand-maintained and stale; its generator is broken

1 participant