Skip to content

chore: modernize toolchain to vite-plus + turbo and prune dead code - #436

Merged
aidenybai merged 8 commits into
mainfrom
chore/modernize-toolchain-cleanup-deadcode
May 1, 2026
Merged

aidenybai merged 8 commits into
mainfrom
chore/modernize-toolchain-cleanup-deadcode

Conversation

@aidenybai

@aidenybai aidenybai commented May 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adopts the react-grab toolchain stack (Vite+ for lint/fmt/check, turbo for pipeline orchestration, pnpm 10, fallow for dead-code analysis) and removes 22 verified-dead files plus 8 unused dependencies that fallow surfaced. Tooling-only — zero changes to React Scan's public API or runtime behavior.

Toolchain

  • pnpm 10 with overrides redirecting `vite` → `@voidzero-dev/vite-plus-core` and `vitest` → `@voidzero-dev/vite-plus-test`, plus `onlyBuiltDependencies` for parcel/watcher, esbuild, sharp, spawn-sync, unrs-resolver.
  • turbo orchestrates `build` / `dev` / `test` / `typecheck` with proper `dependsOn: ["^build"]` so `react-scan` builds before downstream consumers.
  • Vite+ replaces oxlint/postcss-cli at the root via the new `vite.config.ts` (`vp lint`, `vp fmt`, `vp check`).
  • fallow wired in as `pnpm deadcode` / `pnpm deadcode:fix` with `.fallowrc.jsonc` declaring manifest entries, esbuild-read worker, postcss config, and vitest test files as roots.
  • `packages/vite-plugin-react-scan` migrated from raw `tsc` to `vp pack` (tsdown) with proper ESM/CJS + `.d.ts` output.

Cruft removed

  • `scripts/` (`workspace.mjs`, `version-warning.mjs`, `bump-version.js`, `build-worker.ts`) — turbo + changesets handle this now.
  • `bin/` (`serve-scan.sh`, `generate-certs.sh`) — never wired into any `package.json`.
  • `BROWSER_EXTENSION_GUIDE.md` (duplicate of `packages/extension/README.md`).
  • `test-results/`, `.oxlintrc.json` (root + website).

Dead source files (fallow-verified)

`packages/scan/src`: `worker-shim.ts`, `types.d.ts`, `monitoring/`, `web/views/settings/`, `web/views/inspector/{properties.tsx, timeline/index.tsx, logging.ts}`, `web/components/{slider, sticky-section}`, `web/hooks/use-merged-refs.ts`, `web/utils/geiger.ts`, 3 babel helpers in `react-component-name/babel/`.

`packages/website`: `app/react-scan.ts`, `components/{cli, code, counter, footer, test-data-types, todo-demo}.tsx`.

Dead dependencies (fallow-confirmed)

Package Removed
scan `@babel/generator`, `estree-walker`, `@types/node` (dup), `react-router`, `react-router-dom`
vite-plugin-react-scan `@babel/plugin-transform-react-jsx`, `@babel/preset-typescript`
extension `bestzip`
website + `postcss-load-config` (was unlisted)

`react-doctor` and `react-grab` kept by request and added to `.fallowrc.jsonc` `ignoreDependencies` so they no longer appear in reports.

Docs

  • `AGENTS.md` rewritten in react-grab's structure with a tailored Preact + @preact/signals section (signals via `.value`, `useSignal`/`useComputed`/`useSignalEffect`, effect taxonomy, JSX/DOM rules).
  • `CONTRIBUTING.md` updated to reference Vite+/oxlint/oxfmt instead of the stale Biome mention; commands match the new root scripts.

Incidental code fixes

Required by the new tsconfig (`module: ESNext` + `moduleResolution: bundler`):

  • Added `import type { JSX } from 'preact'` in `copy-to-clipboard` and `collapsed-event` so bare `JSX.Element` annotations resolve.
  • Removed dead `cheerio.Element` annotation in `vite-plugin-react-scan` (cheerio 1.x types).
  • `packages/vite-plugin-react-scan/tsconfig.json` now extends the root.
  • Added `*.css?inline` ambient declaration in `extension/src/vite-env.d.ts` (vite-plus-core's `vite/client` doesn't ship one).

Out of scope (follow-up PRs)

Surfaced by `pnpm deadcode` so they're trackable from now on:

  • 95 unused exports + 10 unused type exports
  • 4 duplicate exports
  • 20 circular dependencies in `core/` and `web/views/inspector/`

Test plan

  • `pnpm install` (pnpm 10.24.0, with overrides applied)
  • `pnpm build` — all 4 packages succeed (`react-scan`, `@react-scan/extension`, `@react-scan/vite-plugin-react-scan`, `@react-scan/website`)
  • `pnpm typecheck` — all 4 packages clean
  • `pnpm deadcode` — 0 unused files, 0 unused dependencies (only the punted exports/cycles remain)
  • `pnpm --filter @react-scan/kitchen-sink build` succeeds
  • `pnpm test:e2e` (Playwright against kitchen-sink on :5173)

Note

Medium Risk
Moderate risk because it rewires the build/lint/test toolchain (turbo/Vite+), bumps CI Node versions, and removes a large set of files; failures would surface as packaging/CI or missing-code regressions rather than runtime API changes.

Overview
Modernizes the repo toolchain by switching root and package scripts to turbo-orchestrated workflows and vite-plus commands (vp lint/fmt/check/test/pack), and standardizes on Node.js 22 + pnpm 10 (including pnpm.onlyBuiltDependencies and Vite/Vitest overrides).

Updates CI workflows accordingly (Node 22, pnpm setup/cache) and adjusts package build configs/types (e.g., vite-plugin-react-scan now ships dual ESM/CJS via vp pack and explicit exports; scan/extension add missing ambient/type imports).

Prunes a large set of verified-dead scripts/docs/components/utilities across packages/scan and packages/website, removes legacy lint configs, and cleans up repo ignores (adds .turbo/, removes cert ignore entries).

Reviewed by Cursor Bugbot for commit 255968c. Bugbot is set up for automated code reviews on this repo. Configure here.

Adopts the react-grab toolchain stack (Vite+ for lint/fmt/check, turbo
for pipeline orchestration, pnpm 10, fallow for dead-code analysis) and
removes 22 verified-dead files plus 8 unused dependencies that fallow
surfaced.

Toolchain:
- pnpm 10 with overrides redirecting vite -> @voidzero-dev/vite-plus-core
  and vitest -> @voidzero-dev/vite-plus-test, plus onlyBuiltDependencies
- turbo orchestrates build/dev/test/typecheck with proper ^build deps
- vite-plus replaces oxlint/postcss-cli at the root via vite.config.ts
- fallow wired in as `pnpm deadcode` with .fallowrc.jsonc declaring
  manifest entries, esbuild-read worker, postcss config, and vitest tests
  as roots
- packages/vite-plugin-react-scan migrated from raw tsc to `vp pack`
  (tsdown) with proper ESM/CJS + .d.ts output

Cruft removed:
- scripts/ (workspace.mjs, version-warning.mjs, bump-version.js,
  build-worker.ts) -> turbo + changesets handle this now
- bin/ (serve-scan.sh, generate-certs.sh) -> never wired up
- BROWSER_EXTENSION_GUIDE.md (duplicate of packages/extension/README.md)
- test-results/, .oxlintrc.json (root + website)

Dead source files (fallow-verified):
- packages/scan/src: worker-shim.ts, types.d.ts, monitoring/,
  web/views/settings/, web/views/inspector/{properties.tsx,
  timeline/index.tsx, logging.ts}, web/components/{slider,
  sticky-section}, web/hooks/use-merged-refs.ts, web/utils/geiger.ts,
  3 babel helpers in react-component-name/babel/
- packages/website: app/react-scan.ts, components/{cli, code, counter,
  footer, test-data-types, todo-demo}.tsx

Dead deps removed (fallow-confirmed):
- scan: @babel/generator, estree-walker, @types/node (dup),
  react-router, react-router-dom
- vite-plugin-react-scan: @babel/plugin-transform-react-jsx,
  @babel/preset-typescript
- extension: bestzip
- website: postcss-load-config added (was unlisted)
- Kept react-doctor + react-grab per request; ignored via fallow config

Docs:
- AGENTS.md rewritten with react-grab structure and a tailored
  Preact + @preact/signals section
- CONTRIBUTING.md updated to reference Vite+/oxlint/oxfmt instead of the
  stale Biome mention

Incidental fixes for the new tsconfig:
- Added `import type { JSX } from 'preact'` in copy-to-clipboard and
  collapsed-event so bare JSX.Element types resolve under bundler
  resolution
- Removed dead cheerio.Element annotation in vite-plugin-react-scan
- packages/vite-plugin-react-scan/tsconfig now extends the root with
  module: ESNext / moduleResolution: bundler
- Added *.css?inline ambient declaration in extension's vite-env.d.ts

Punted to follow-up PRs (visible via `pnpm deadcode`):
- 95 unused exports + 10 unused type exports
- 4 duplicate exports
- 20 circular dependencies
@vercel

vercel Bot commented May 1, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
react-scan Ready Ready Preview, Comment May 1, 2026 1:14pm

Comment thread packages/scan/package.json Resolved
P0 — runtime breakages:
- Restore @babel/preset-typescript + @babel/plugin-transform-react-jsx
  as runtime dependencies of vite-plugin-react-scan; they are loaded by
  string name inside @babel/core's transformAsync call. Add to fallow's
  ignoreDependencies so the static analyzer stops flagging them.
- Switch packages/vite-plugin-react-scan vp pack config to
  fixedExtension: false so ESM output is dist/index.js (matches the
  package.json `module`/`exports.import.default` paths). Without this,
  ESM consumers would hit ERR_MODULE_NOT_FOUND.

P1 — broken dev workflows:
- Fix `pnpm test` for scan: switch script to `vp test run` (the vitest
  pnpm override target has no `bin`), drop the vite-tsconfig-paths
  plugin import from vite.config.mts (Vite+ has built-in tsconfig path
  resolution), and add a `test:watch` script. All 161 tests pass.
- Fix `pack:bump` for scan: rename scripts/bump-version.js to .mjs (the
  file uses ESM syntax and scan/package.json is CJS by default), wire
  __dirname through fileURLToPath, and update the script reference.

P2 — fragile hoisting:
- Add `autoprefixer` to kitchen-sink/devDependencies so it doesn't rely
  on transitive hoisting from packages/scan.

Verified: pnpm typecheck (4/4), pnpm build (4/4), pnpm test in scan
(161/161), pnpm deadcode (0 unused files / 0 unused deps).
- pack:bump: Bugbot caught that swapping `nr pack` -> `pnpm pack` lost
  the build step (pnpm pack is the built-in tarball command, not the
  script). Use `pnpm run pack` to invoke the script chain
  (npm version patch && pnpm build && npm pack).
- CI workflows: drop the hardcoded pnpm 9.x version (conflicted with
  packageManager: pnpm@10.24.0 declared in root package.json), let
  pnpm/action-setup read it from packageManager. Also bump Node from
  18/20 -> 22 to match engines.node.
@pkg-pr-new

pkg-pr-new Bot commented May 1, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/react-scan@436

commit: 255968c

Comment thread package.json Resolved
Drop the fallow dead-code analyzer wiring per request:
- Delete .fallowrc.jsonc
- Remove `deadcode` / `deadcode:fix` scripts and the fallow devDep
- Drop the .fallow/ cache entry from .gitignore
- Remove fallow references from AGENTS.md and CONTRIBUTING.md
After overriding `vite` -> `@voidzero-dev/vite-plus-core` (which has no
`bin`), packages calling `vite build` / `vite dev` directly fail to
resolve a binary on a clean install. Switch the extension and
kitchen-sink scripts to `vp build` / `vp dev` to match the react-grab
pattern. vp loads the existing vite.config.ts files transparently
(rolldown-vite under the hood, vite-plugin-web-extension still works).

Verified end-to-end on a clean install:
- pnpm install --frozen-lockfile ✓
- pnpm build (4/4 packages) ✓
- pnpm typecheck (4/4) ✓
- pnpm test (161/161 in scan) ✓
- pnpm --filter @react-scan/kitchen-sink build ✓ (produces dist/)
- pnpm --filter @react-scan/extension build ✓ (produces dist/manifest.json + chunks)

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

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 1021d77. Configure here.

- Restore @react-scan/vite-plugin-react-scan version 0.2.4 (accidentally
  downgraded to 0.2.3 when I rewrote package.json) and bump react-scan
  peer back to >=0.5.4. Catches Bugbot's "Package version accidentally
  downgraded" Medium finding.
- Drop the duplicate `pnpm.overrides` block from root package.json.
  pnpm-workspace.yaml already declares vite/vitest overrides with proper
  version pins (@^0.1.12) and is the canonical location in pnpm 9+.
  Catches Bugbot's "Duplicate overrides with inconsistent version
  constraints" Low finding. Verified the override still resolves -
  packages/extension/node_modules/vite still aliases to
  @voidzero-dev/vite-plus-core 0.1.20.

Other Bugbot comments are stale/already-fixed:
- "Removed babel deps" (High) - the deps were restored in cfd08fb.
- "Build step lost in pack:bump" (Medium) - fixed in e645345.
Vercel deploys the website with rootDirectory=packages/website and runs
`pnpm build` directly inside it (turbo's filter graph doesn't apply).
The presync step needs ../scan/dist/auto.global.js to exist, so we have
to build scan first within the website's own build script.

Restores the original prefix:
  pnpm --filter react-scan build && pnpm presync && next build
Vercel still pins old projects to pnpm 9.x by default. pnpm 9 reads
overrides only from package.json (not pnpm-workspace.yaml), so dropping
the duplicate caused ERR_PNPM_LOCKFILE_CONFIG_MISMATCH on Vercel.

Restore the package.json `pnpm.overrides` block alongside the
pnpm-workspace.yaml block (matching react-grab's pattern), with the
same versioned spec `@^0.1.12` so they don't drift. Reverts part of
the Bugbot Low-severity finding (#3) — the duplicate is intentional
backwards-compat, not a footgun.
@aidenybai
aidenybai merged commit f34a13b into main May 1, 2026
6 checks passed
@aidenybai
aidenybai deleted the chore/modernize-toolchain-cleanup-deadcode branch May 1, 2026 13:46
hunixcode pushed a commit to hunixcode/react-scan that referenced this pull request Jul 3, 2026

This branch was successfully deployed

1 active deployment
Preview — 255968c5 Deployed May 1, 2026 by vercel[bot]
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