Skip to content

Add isomorphic react-doctor-core workspace package#133

Open
cursor[bot] wants to merge 13 commits intomainfrom
aiden/isomorphic-core-react-doctor
Open

Add isomorphic react-doctor-core workspace package#133
cursor[bot] wants to merge 13 commits intomainfrom
aiden/isomorphic-core-react-doctor

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor bot commented Apr 18, 2026

Summary

Introduces react-doctor-core, an environment-agnostic (isomorphic) workspace package: diagnostic scoring, oxlint JSON parsing/normalization, and the oxlint rule plugin (moved from packages/react-doctor/src/plugin). Optional /browser subpath omits the plugin for smaller bundles.

Introduces react-doctor-web, a thin package that re-exports react-doctor-core/browser so web apps and client bundles depend on a single web-oriented entry instead of reaching into core subpaths.

The react-doctor CLI and ./api export stay the same at the package boundary; Node-only orchestration remains in react-doctor and depends on the core for pure helpers; the plugin is built from the core entry.

The website score API routes and client smoke tests import react-doctor-web. next.config.ts sets transpilePackages: ["react-doctor-web", "react-doctor-core"].

Follow-up fix: react-doctor-core uses extensionless relative imports so Next.js Turbopack can resolve .ts sources when transpiling the workspace package.

Browser validation: Playwright e2e builds the website, starts production Next on port 4007, opens /dev/react-doctor-web-smoke, and asserts calculateScoreLocally from react-doctor-web in the client bundle (Chromium). Root pnpm test runs core tests, react-doctor-web typecheck, react-doctor tests, then Playwright.

CI: playwright install chromium --with-deps before pnpm test.

What changed (files / areas)

  • packages/react-doctor-core/: plugin, parsing, scoring, types; Vitest tests; isomorphic-focused description.
  • packages/react-doctor-web/ (new): workspace:* on core; src/index.ts re-exports react-doctor-core/browser.
  • packages/react-doctor: depends on core; build/plugin wiring unchanged in spirit.
  • packages/website: depends on react-doctor-web; API routes + dev smoke + e2e use it; transpile both packages.
  • Root package.json: test runs react-doctor-web typecheck after core unit tests.

What remained Node-only (unchanged responsibility)

  • Filesystem / process / subprocess: discover-project, git, knip, temp oxlint config, spawn of oxlint, proxy-fetch, CLI, etc.

Follow-ups

  • In-browser linting still needs a WASM/worker oxlint runner; core only parses/scores JSON you supply.
  • react-doctor npm CLI remains Node-only.
Open in Web Open in Cursor 

…nd oxlint parsing

- Move oxlint plugin sources to workspace package react-doctor-core
- Extract parseOxlintOutput and score helpers without Node APIs
- Wire react-doctor CLI/API to core; build plugin from core entry
- Reuse core in website score and estimate-score API routes
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-doctor-website Ready Ready Preview, Comment Apr 19, 2026 2:14am

…resolution

Turbopack resolves transpiled workspace sources as .ts; .js specifiers
failed module resolution during website build.
@NisargIO NisargIO marked this pull request as ready for review April 18, 2026 02:00
Take main's refactored calculate-score re-export and tsdown config
with browser/worker entries and local plugin path.
Comment thread packages/website/src/app/api/score/route.ts Outdated
Copy link
Copy Markdown

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

Build entry point references non-existent plugin directory ./src/plugin/index.ts causing build failure

Fix on Vercel

…ndle

- Add /dev/react-doctor-core-smoke client page importing calculateScoreLocally
- Add Playwright config (ESM .mjs) and e2e spec; wire root pnpm test
- Ignore Playwright artifacts; use port 4007 for webServer to avoid clashes
…p dead score helper

- CI: playwright install chromium before pnpm test (e2e needs browser binaries)
- tsdown: build react-doctor-plugin from react-doctor-core again; remove invalid entries
- api/score: remove unused calculateNumericScore and PERFECT_SCORE import (Bugbot)
Copy link
Copy Markdown
Author

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7eba82c. Configure here.

Comment thread packages/react-doctor/tsdown.config.ts
Comment thread packages/react-doctor-core/src/score.ts
- New react-doctor-web re-exports react-doctor-core/browser for web/client use
- Website API routes, smoke page, and e2e import react-doctor-web; transpile both packages
- Core package.json description stresses isomorphic/runtime-neutral scope
- Root test runs react-doctor-web typecheck
index: "./src/index.ts",
},
external: ["oxlint", "knip", "knip/session"],
external: ["oxlint", "knip", "knip/session", "react-doctor-core"],
Copy link
Copy Markdown

@vercel vercel bot Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The browser and worker build entries were accidentally removed from tsdown.config.ts, causing package.json exports to reference non-existent dist files.

Fix on Vercel

- Shared DiagnosticInput, isValidDiagnostic, CORS headers, OPTIONS handler
- parseDiagnosticsFromBody for both /api/score and /api/estimate-score
- Shorten react-doctor-web package description
…NTS.md

- Split score API helpers into utils/ with constants for HTTP status codes
- Avoid Record casts in parse-diagnostics via Reflect.get
- Re-export core types via export { type ... } instead of export type blocks
- Add root typecheck script per AGENTS.md
…nses

- Reuse Diagnostic from react-doctor-web instead of duplicating DiagnosticInput
- Single Record read in guard; respondWithScoreApiClientError for 400 JSON
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