Skip to content

Track generated route tree in scaffolds#464

Merged
tannerlinsley merged 1 commit into
mainfrom
taren/track-route-tree
Jun 5, 2026
Merged

Track generated route tree in scaffolds#464
tannerlinsley merged 1 commit into
mainfrom
taren/track-route-tree

Conversation

@tannerlinsley
Copy link
Copy Markdown
Member

@tannerlinsley tannerlinsley commented Jun 5, 2026

What changed

  • Stop adding src/routeTree.gen.ts to generated React and Solid app gitignores.
  • Add generate-routes scripts, @tanstack/router-cli, and tsr.config.json to the file-router scaffolds.
  • Run route generation once after dependency install during create so the first TypeScript check has routeTree.gen.ts available.
  • Update the changeset note to match the corrected behavior.

Why

routeTree.gen.ts is generated, but it is still source input for Router type checking. Ignoring it by default means a fresh checkout can fail tsc unless users run dev/build first. The scaffold should track the file and only hide it from editor/lint noise.

Validation

  • pnpm --filter @tanstack/create build
  • pnpm --filter @tanstack/create exec tsc --noEmit
  • pnpm --filter @tanstack/create test
  • Commit hook also ran root build, unit tests, and blocking e2e successfully.

Summary by CodeRabbit

  • New Features
    • Automatic route generation now runs during app scaffold for React and Solid file-router projects
    • Added generate-routes npm script for manual route regeneration in new projects
    • Generated route tree files are now tracked in version control instead of being ignored

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Worried about impact? Review this PR in Change Stack to explore blast radius before you approve or request changes.

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a8526d1b-c015-4485-9362-231c68814e1f

📥 Commits

Reviewing files that changed from the base of the PR and between 9f16272 and adabbf0.

📒 Files selected for processing (12)
  • .changeset/track-route-tree.md
  • packages/create/src/create-app.ts
  • packages/create/src/frameworks/react/project/base/_dot_gitignore
  • packages/create/src/frameworks/react/project/base/package.json
  • packages/create/src/frameworks/react/project/base/tsr.config.json
  • packages/create/src/frameworks/react/project/packages.json
  • packages/create/src/frameworks/solid/project/base/_dot_gitignore
  • packages/create/src/frameworks/solid/project/base/package.json
  • packages/create/src/frameworks/solid/project/base/tsr.config.json
  • packages/create/src/frameworks/solid/project/packages.json
  • packages/create/tests/create-app.test.ts
  • packages/create/tests/framework-template.test.ts
💤 Files with no reviewable changes (2)
  • packages/create/src/frameworks/react/project/base/_dot_gitignore
  • packages/create/src/frameworks/solid/project/base/_dot_gitignore
✅ Files skipped from review due to trivial changes (3)
  • .changeset/track-route-tree.md
  • packages/create/src/frameworks/react/project/packages.json
  • packages/create/src/frameworks/solid/project/base/tsr.config.json
🚧 Files skipped from review as they are similar to previous changes (6)
  • packages/create/tests/create-app.test.ts
  • packages/create/tests/framework-template.test.ts
  • packages/create/src/frameworks/solid/project/packages.json
  • packages/create/src/frameworks/solid/project/base/package.json
  • packages/create/src/frameworks/react/project/base/package.json
  • packages/create/src/create-app.ts

📝 Walkthrough

Walkthrough

This PR enables automatic route tree generation in newly scaffolded React and Solid file-router projects by running a generate-routes command during setup, tracking the generated file in Git, provisioning framework templates with route generation tooling, and adding corresponding test coverage.

Changes

Route Tree Generation Integration

Layer / File(s) Summary
Changeset Documentation
.changeset/track-route-tree.md
Documents the patch release declaring that generated route trees are now tracked in Git and route generation runs once during scaffold for React and Solid.
App Creation Route Generation Orchestration
packages/create/src/create-app.ts
Adds conditional post-install logic to run the generate-routes package-manager script when install is enabled, mode is file-router, and framework is react or solid. Introduces shouldGenerateRoutes(options) helper to gate the behavior.
React Framework Route Generation Setup
packages/create/src/frameworks/react/project/base/(_dot_gitignore, package.json, tsr.config.json), packages/create/src/frameworks/react/project/packages.json
Removes src/routeTree.gen.ts from .gitignore, adds generate-routes npm script, creates tsr.config.json with React target, and adds @tanstack/router-cli as a file-router dev dependency.
Solid Framework Route Generation Setup
packages/create/src/frameworks/solid/project/base/(_dot_gitignore, package.json, tsr.config.json), packages/create/src/frameworks/solid/project/packages.json
Removes src/routeTree.gen.ts from .gitignore, adds generate-routes npm script, creates tsr.config.json with Solid target, and adds @tanstack/router-cli as a file-router dev dependency.
Route Generation Test Coverage
packages/create/tests/create-app.test.ts, packages/create/tests/framework-template.test.ts
Adds tests that pnpm generate-routes runs for React and Solid when install is enabled, skips when disabled, verifies route tree is not ignored in gitignore, and checks framework templates include route generation tooling and dependencies.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A route tree grows with tidy care, 🌲
Now tracked in git, no longer spare,
React and Solid scaffold fresh,
With tsr generate to enmesh,
Fine-grained routes the user will find!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main change: stopping the exclusion of generated route trees from .gitignore files so they are tracked in scaffolds.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch taren/track-route-tree

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/create/tests/create-app.test.ts

Parsing error: "parserOptions.project" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided project(s): packages/create/tests/create-app.test.ts

packages/create/tests/framework-template.test.ts

Parsing error: "parserOptions.project" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided project(s): packages/create/tests/framework-template.test.ts


Comment @coderabbitai help to get the list of available commands and usage tips.

@tannerlinsley tannerlinsley force-pushed the taren/track-route-tree branch from 9f16272 to adabbf0 Compare June 5, 2026 22:45
@tannerlinsley tannerlinsley merged commit 3811aac into main Jun 5, 2026
7 checks passed
@tannerlinsley tannerlinsley deleted the taren/track-route-tree branch June 5, 2026 22:49
@github-actions github-actions Bot mentioned this pull request Jun 5, 2026
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