fix: detect Next.js route groups as valid project structure#3090
fix: detect Next.js route groups as valid project structure#3090mvanhorn wants to merge 1 commit intoonlook-dev:mainfrom
Conversation
The project validator failed to recognize Next.js projects using route groups (parenthesized directories like (app), (dashboard)). The isTargetFile function did an exact directory match against potential paths, missing layout files inside route group subdirectories. Added route group pattern matching to isTargetFile so that paths like app/(marketing)/layout.tsx match the potentialPath 'app'. Fixes onlook-dev#2936
|
@mvanhorn is attempting to deploy a commit to the Onlook Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughEnhances the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
Summary
Next.js projects using route groups (parenthesized directories like
(app),(dashboard)) were rejected during project import because the validator only checked for layout files at the exactapp/orsrc/app/path level.Changes
Modified
isTargetFileinpackages/utility/src/path.tsto also match files inside Next.js route group subdirectories. A route group directory matches the(name)pattern per the Next.js App Router spec.For example,
app/(marketing)/layout.tsxnow correctly matches the potential pathapp.Added 5 test cases covering route group paths, including edge cases for nested directories and non-group directories.
Testing
bun test packages/utility/test/path.test.ts)bun run typecheck)app/marketing/layout.tsx) are still correctly rejectedFixes #2936
This contribution was developed with AI assistance (Claude Code).
Summary by CodeRabbit
New Features
Tests