Skip to content

fix(cli): include React workspace root in project selection#16

Open
abekdwight wants to merge 1 commit intomillionco:mainfrom
abekdwight:fix/include-root-project-in-selection
Open

fix(cli): include React workspace root in project selection#16
abekdwight wants to merge 1 commit intomillionco:mainfrom
abekdwight:fix/include-root-project-in-selection

Conversation

@abekdwight
Copy link

Summary

  • Include React workspace root project in the selectable project list
  • Add discoverRootReactPackage to detect React dependency on workspace root
  • Update project selection flow to append root project with duplicate guard (name/directory)
  • Add tests for root inclusion, root resolution via --project, and non-React root exclusion

Why

In monorepo setups, react-doctor listed only workspace sub-packages and did not include the workspace root even when the root package used React. This prevented users from selecting and scanning root-based apps directly.

Architecture Changes

TypeScript (CLI):

  • Add discoverRootReactPackage(rootDirectory) in discover-project.ts
  • Keep hasReactDependency as an internal helper (non-exported)
  • In select-projects.ts, append root candidate when eligible and not duplicated
  • Preserve existing fallback behavior when no candidates are found

Tests:

  • Add tests/select-projects.test.ts
    • includes root package when workspace candidates exist
    • resolves root package with --project
    • excludes root package when root has no React dependency

Test Plan

  • pnpm --filter react-doctor run test -- select-projects
  • pnpm --filter react-doctor run typecheck
  • Manual verification: root project appears as selectable option in monorepo (l-shift-4)

Files Changed

Updated:

  • packages/react-doctor/src/utils/discover-project.ts
  • packages/react-doctor/src/utils/select-projects.ts

Added:

  • packages/react-doctor/tests/select-projects.test.ts

@vercel
Copy link

vercel bot commented Feb 17, 2026

@abekdwight is attempting to deploy a commit to the Million Team on Vercel.

A member of the Team first needs to authorize it.

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