Add isomorphic react-doctor-core workspace package#133
Open
cursor[bot] wants to merge 13 commits intomainfrom
Open
Add isomorphic react-doctor-core workspace package#133cursor[bot] wants to merge 13 commits intomainfrom
cursor[bot] wants to merge 13 commits intomainfrom
Conversation
…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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…resolution Turbopack resolves transpiled workspace sources as .ts; .js specifiers failed module resolution during website build.
Take main's refactored calculate-score re-export and tsdown config with browser/worker entries and local plugin path.
…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)
Author
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ 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.
- 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"], |
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Introduces
react-doctor-core, an environment-agnostic (isomorphic) workspace package: diagnostic scoring, oxlint JSON parsing/normalization, and the oxlint rule plugin (moved frompackages/react-doctor/src/plugin). Optional/browsersubpath omits the plugin for smaller bundles.Introduces
react-doctor-web, a thin package that re-exportsreact-doctor-core/browserso web apps and client bundles depend on a single web-oriented entry instead of reaching into core subpaths.The
react-doctorCLI and./apiexport stay the same at the package boundary; Node-only orchestration remains inreact-doctorand 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.tssetstranspilePackages: ["react-doctor-web", "react-doctor-core"].Follow-up fix:
react-doctor-coreuses extensionless relative imports so Next.js Turbopack can resolve.tssources 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 assertscalculateScoreLocallyfromreact-doctor-webin the client bundle (Chromium). Rootpnpm testruns core tests,react-doctor-webtypecheck, react-doctor tests, then Playwright.CI:
playwright install chromium --with-depsbeforepnpm 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.tsre-exportsreact-doctor-core/browser.packages/react-doctor: depends on core; build/plugin wiring unchanged in spirit.packages/website: depends onreact-doctor-web; API routes + dev smoke + e2e use it; transpile both packages.package.json: test runsreact-doctor-webtypecheck after core unit tests.What remained Node-only (unchanged responsibility)
discover-project, git, knip, temp oxlint config,spawnof oxlint,proxy-fetch, CLI, etc.Follow-ups
react-doctornpm CLI remains Node-only.