Skip to content

fix(cli): adapt to shadcn template drift breaking TanStack Start and Next.js scaffolds - #34

Open
envindavsorg wants to merge 1 commit into
agmmnn:masterfrom
envindavsorg:fix/scroll-container-wrong-main
Open

fix(cli): adapt to shadcn template drift breaking TanStack Start and Next.js scaffolds#34
envindavsorg wants to merge 1 commit into
agmmnn:masterfrom
envindavsorg:fix/scroll-container-wrong-main

Conversation

@envindavsorg

@envindavsorg envindavsorg commented Jun 6, 2026

Copy link
Copy Markdown

Problem

bun create tauri-ui currently fails for two of the five templates because the upstream shadcn templates changed shape:

TanStack Start — scaffolding always aborts with:

▲  Scaffolding failed
└  Could not mount ExternalLinkGuard in the TanStack Start root route.

The generated src/routes/__root.tsx now ships a notFoundComponent containing its own <main className="container mx-auto p-4 pt-16">, declared before RootDocument. The scroll-container battery's "upgrade an existing <main>" regex matched the first <main> in the file, so it tagged the 404 page's element with data-ui-scroll-container instead of wrapping {children}. The external-link-guard battery then couldn't find <main…>{children}</main> and threw, aborting the whole scaffold.

Next.js — scaffolding aborts with ENOENT: no such file or directory, open '…/next.config.mjs'. The template now generates a typed next.config.ts (const nextConfig: NextConfig = {}) and a plain "dev": "next dev" script without --turbopack, so the static-export patch crashed and the -p 1420 port rewrite silently no-opped.

Fix

  • batteries/scroll-container.ts: the upgrade path now only targets a <main> that directly wraps the route content ({children}, <App />, <Outlet />, <slot />) via a lookahead anchor passed per template, leaving unrelated <main> elements (like the Start 404 page) untouched. Also hardened the idempotency check so a previously upgraded <main> carrying extra attributes is still detected.
  • adapters/next.ts: resolves next.config.ts/.mjs/.js (first match), patches both the typed and untyped empty-config shapes, and appends -p 1420 to any next dev script that doesn't already pin a port.

Verification

  • Reproduced the original failure with --template start before the fix.
  • After the fix, the exact failing invocation (--template start --no-starter --size-optimize --workflow) scaffolds successfully and the generated app passes bun install && bun run build.
  • Full simple test matrix (node scripts/test-create-tauri-ui-simple.mjs) passes for all five templates:
- PASS vite (14.5s)
- PASS next (20.2s)
- PASS start (15.4s)
- PASS react-router (15.2s)
- PASS astro (18.4s)
  • oxlint / oxfmt --check / tsc --noEmit clean (the single pre-existing libRoot warning on master is untouched).
  • Changeset included (patch bump for create-tauri-ui).

…folds

TanStack Start scaffolds aborted with "Could not mount ExternalLinkGuard
in the TanStack Start root route." The upstream template now ships a
notFoundComponent with its own <main> before RootDocument, and the
scroll-container battery's "upgrade an existing <main>" regex matched
the first <main> in the file — tagging the 404 page's element instead of
wrapping {children}, which left nothing for the external-link-guard
battery to mount into. The upgrade path now only targets a <main> that
directly wraps the route content ({children}, <App />, <Outlet />,
<slot />) across all five templates.

Next.js scaffolds aborted with ENOENT on next.config.mjs. The template
now generates a typed next.config.ts and a plain "next dev" script
without --turbopack. The adapter now resolves next.config.{ts,mjs,js},
patches the typed config shape, and appends -p 1420 to any "next dev"
script that doesn't already pin a port.

Verified with the simple test matrix: all five templates scaffold and
build cleanly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 6, 2026

Copy link
Copy Markdown

@envindavsorg is attempting to deploy a commit to the agmmnn's projects Team on Vercel.

A member of the Team first needs to authorize it.

@anton-liam

Copy link
Copy Markdown

when will merge it, i cant create project with nextjs template

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.

2 participants