Skip to content
Source
Sign inSign up
TanStack/cli

fix(create): generate minimal scaffolding when declining demo/example pages #429

ClosedwyMinLwin(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/429/headopened

For #422

Pass includeExamples to the EJS template context and conditionally render minimal output (no Header, Footer, ThemeToggle, theme system, or styled pages) for both React and Solid frameworks when the user selects "No" for demo/example pages.

Summary by CodeRabbit

  • New Features

    • Projects can now be generated as either a minimal starter or a full starter with example components, sample routes, and richer layout and styling options for React and Solid projects.
  • Tests

    • Added test coverage for the new template-context behavior, ensuring the minimal vs full template selection and skipped/generated files behave as expected.
    1. No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: defaults

      Review profile: CHILL

      Plan: Pro

      Run ID: c21771bb-c0b1-4af9-bd68-d546d2627db5

      📥 Commits

      Reviewing files that changed from the base of the PR and between cc22c9c16c7afb8320e40a56c6cbb4e5399bcc82 and 7f2732f7cc6fb242520418e0e96f3a562faa1787.

      📒 Files selected for processing (1)
      • packages/create/src/frameworks/solid/project/base/src/routes/__root.tsx.ejs
      🚧 Files skipped from review as they are similar to previous changes (1)
      • packages/create/src/frameworks/solid/project/base/src/routes/__root.tsx.ejs

      📝 Walkthrough

      Walkthrough

      Adds an includeExamples template-context flag and branches in EJS templates to either emit minimal/stub assets or full example code across React and Solid starter files; tests and template rendering now respect this flag.

      Changes

      Cohort / File(s)Summary
      React - Component Guards
      packages/create/src/frameworks/react/project/base/src/components/Footer.tsx.ejs, packages/create/src/frameworks/react/project/base/src/components/Header.tsx.ejs, packages/create/src/frameworks/react/project/base/src/components/ThemeToggle.tsx.ejs
      Inserted top-of-file EJS guards that call ignoreFile() and return when includeExamples is false, preventing those component files from being generated.
      React - Routes
      packages/create/src/frameworks/react/project/base/src/routes/__root.tsx.ejs, packages/create/src/frameworks/react/project/base/src/routes/about.tsx.ejs, packages/create/src/frameworks/react/project/base/src/routes/index.tsx.ejs
      __root.tsx.ejs: added !includeExamples branch defining a full root route (context types, shellComponent, head/beforeLoad, providers, devtools). about.tsx.ejs: added guard to skip file. index.tsx.ejs: conditional export wiring — uses minimal Home when !includeExamples, otherwise App.
      React - Styles
      packages/create/src/frameworks/react/project/base/src/styles.css.ejs
      Wrapped stylesheet template in conditional: emits minimal Tailwind import and resets when includeExamples is false; retains full stylesheet (typography, theme variables) when true.
      Solid - Component Guard
      packages/create/src/frameworks/solid/project/base/src/components/Header.tsx.ejs
      Added top-of-file EJS guard that calls ignoreFile() and returns when includeExamples is false, skipping header generation.
      Solid - Routes
      packages/create/src/frameworks/solid/project/base/src/routes/__root.tsx.ejs, packages/create/src/frameworks/solid/project/base/src/routes/about.tsx.ejs, packages/create/src/frameworks/solid/project/base/src/routes/index.tsx.ejs
      __root.tsx.ejs: added !includeExamples branch producing a root route with HTML shell, head links, Suspense/HydrationScript, add-on init and devtools. about.tsx.ejs: added guard to skip file. index.tsx.ejs: conditional route uses Home when !includeExamples, otherwise App.
      Solid - Styles
      packages/create/src/frameworks/solid/project/base/src/styles.css.ejs
      Wrapped stylesheet template in conditional: minimal Tailwind import and global resets when includeExamples is false; full stylesheet preserved when true.
      Template System
      packages/create/src/template-file.ts
      Added templateValues.includeExamples derived from options.includeExamples (defaults to true) and passed into EJS render context.
      Tests
      packages/create/tests/template-context.test.ts
      Added tests verifying includeExamples defaults to true, respects explicit false, and that ignoreFile() behavior skips generation of example files when includeExamples is false.

      Estimated code review effort

      🎯 4 (Complex) | ⏱️ ~45 minutes

      Poem

      🐇 I nibbled flags in template ground, When examples sleep, only stubs are found. From Header to Root I hopped with glee, Tests keep the burrow tidy for me. Small or full, the starter springs free. 🎉

      🚥 Pre-merge checks | ✅ 2 | ❌ 1

      ❌ Failed checks (1 warning)

      Check nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring 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 (2 passed)
      Check nameStatusExplanation
      Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Title check✅ PassedThe title accurately describes the main change: adding conditional minimal scaffolding generation when users decline example pages, which is the core feature across all modified template files.
      ✏️ Tip: You can configure your own custom pre-merge checks in the settings.
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    2. Actionable comments posted: 1

      🧹 Nitpick comments (1)
      packages/create/tests/template-context.test.ts (1)

      316-376: Add framework-level fixture assertions for minimal scaffold output.

      This suite validates context plumbing and ignoreFile() control flow, but it does not yet verify the user-facing contract (e.g., actual omission of React/Solid Header, Footer, ThemeToggle, and /about from generated scaffolds). Adding one fixture-style generation test per framework would reduce regression risk.

      🤖 Prompt for AI Agents
      Verify each finding against the current code and only fix it if needed.
      
      In `@packages/create/tests/template-context.test.ts` around lines 316 - 376, The
      tests exercise includeExamples and ignoreFile() logic but lack higher-level
      fixture assertions that verify generated scaffolds actually omit user-facing
      pieces (e.g., React/Solid Header, Footer, ThemeToggle, and /about); add one
      integration-style test per framework that uses createMemoryEnvironment() and
      createTemplateFile() to generate a minimal scaffold with includeExamples: false
      and then assert output.files does not contain the framework-specific
      files/components (e.g., verify '/about', 'Header', 'Footer', 'ThemeToggle'
      module paths are absent) to catch regressions in template plumbing and
      ignoreFile() usage.
      🤖 Prompt for all review comments with AI agents
      Verify each finding against the current code and only fix it if needed.
      
      Inline comments:
      In `@packages/create/src/frameworks/solid/project/base/src/routes/__root.tsx.ejs`:
      - Around line 47-59: The HeadContent component is currently rendered inside
      <body> causing hydration and meta tag issues; move the <HeadContent /> render
      into the <head> block (near HydrationScript) so head-related tags are injected
      in the document head; update the template around HydrationScript and ensure any
      layout integrations loop (the integrations.filter(i => i.type === 'layout')
      insertion) remains in the body/Suspense area while HeadContent is relocated to
      the head section.
      
      ---
      
      Nitpick comments:
      In `@packages/create/tests/template-context.test.ts`:
      - Around line 316-376: The tests exercise includeExamples and ignoreFile() logic
      but lack higher-level fixture assertions that verify generated scaffolds
      actually omit user-facing pieces (e.g., React/Solid Header, Footer, ThemeToggle,
      and /about); add one integration-style test per framework that uses
      createMemoryEnvironment() and createTemplateFile() to generate a minimal
      scaffold with includeExamples: false and then assert output.files does not
      contain the framework-specific files/components (e.g., verify '/about',
      'Header', 'Footer', 'ThemeToggle' module paths are absent) to catch regressions
      in template plumbing and ignoreFile() usage.
      🪄 Autofix (Beta)

      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: defaults

      Review profile: CHILL

      Plan: Pro

      Run ID: 817d9635-338b-4052-9251-82078c2483c4

      📥 Commits

      Reviewing files that changed from the base of the PR and between 31ae444503bbae7add4a9133411cd3f3f007cad3 and cc22c9c16c7afb8320e40a56c6cbb4e5399bcc82.

      📒 Files selected for processing (14)
      • packages/create/src/frameworks/react/project/base/src/components/Footer.tsx.ejs
      • packages/create/src/frameworks/react/project/base/src/components/Header.tsx.ejs
      • packages/create/src/frameworks/react/project/base/src/components/ThemeToggle.tsx.ejs
      • packages/create/src/frameworks/react/project/base/src/routes/__root.tsx.ejs
      • packages/create/src/frameworks/react/project/base/src/routes/about.tsx.ejs
      • packages/create/src/frameworks/react/project/base/src/routes/index.tsx.ejs
      • packages/create/src/frameworks/react/project/base/src/styles.css.ejs
      • packages/create/src/frameworks/solid/project/base/src/components/Header.tsx.ejs
      • packages/create/src/frameworks/solid/project/base/src/routes/__root.tsx.ejs
      • packages/create/src/frameworks/solid/project/base/src/routes/about.tsx.ejs
      • packages/create/src/frameworks/solid/project/base/src/routes/index.tsx.ejs
      • packages/create/src/frameworks/solid/project/base/src/styles.css.ejs
      • packages/create/src/template-file.ts
      • packages/create/tests/template-context.test.ts
      Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)
    3. Hi @wyMinLwin — thanks for this! I've folded your two commits (with author credit preserved) into #434 along with @WaryaWayne's related work from #431. Feel free to close this one once #434 lands.

Sign in to join this conversation.