Skip to content

chore: replace the toolchain with Vite+ - #167

Merged
lollipop-onl merged 2 commits into
mainfrom
lollipop-onl/chore-vite-plus-toolchain
Sep 28, 2026
Merged

lollipop-onl merged 2 commits into
mainfrom
lollipop-onl/chore-vite-plus-toolchain

Conversation

@lollipop-onl

@lollipop-onl lollipop-onl commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Replaces the split toolchain (turbo, oxlint, oxfmt, vitest, unbuild, lefthook, mise) with Vite+ 1.0.0: one vp binary, one root vite.config.ts, and one CI setup action (voidzero-dev/setup-vp).

Before After
turbo vp run -r
oxlint + .oxlintrc.json, oxfmt vp lint / vp fmt (config in vite.config.ts)
tsc --noEmit lint.options.typeCheck (tsgolint / TS 7), part of vp check / vp lint
vitest 4 vp test (Vitest 5, imports from vite-plus/test)
unbuild vp pack (tsdown)
lefthook .vite-hooks/pre-commit → vp staged (vp check --fix)
mise + Corepack, .node-version, packageManager devEngines in package.json, managed by vp

Behavior changes worth reviewing

  • CI test matrix drops Node 20. Vite+ requires ^22.18 || ^24.11 || >=26. engines.node: ">=20.18" is unchanged; instead, a new smoke job packs the CLI and installs it globally with npm on Node 20/22/24, then runs --version / --help. This also exercises the published dependency list rather than the workspace.
  • Newly surfaced type-aware lint rules are turned off. typeCheck requires typeAware, which enabled category rules that had never run (no-unsafe-type-assertion, prefer-regexp-exec, restrict-template-expressions). Adopting them is left for a separate change; the two trivial hits were fixed instead.
  • @repo/test-utils setup file removed. Vitest 5 enables clearMocks by default. The package also drops its vitest peer dependency — pnpm's auto-installed peer created a second vite-plus instance, so the runner could not clear mocks created in mock-consola.
  • BodyInit shim (hey-api workaround) removed. Nothing references it anymore and tsgolint rejects the duplicate declaration.
  • apps/docs stays outside lint / type check, as it already was in CI.
  • apps/cli/package.json repeats devEngines.runtime so that vp does not pick the dev runtime from engines.node there.

Follow-ups (not in this PR)

  • vite-plus, vite (alias to @voidzero-dev/vite-plus-core), and vitest are exact-pinned in the catalog and must be bumped together.
  • Dropping Node 20 from engines would also unblock the commander / undici majors held back in the catalog.
  • Until this merges, other checkouts sharing the same .git/config have core.hooksPath pointing at .vite-hooks/_, which does not exist on main.

Test plan

  • Clean install (rm -rf node_modules → pnpm install --frozen-lockfile)
  • vp fmt --check and vp lint --max-warnings 0 pass (includes type check)
  • vp test --coverage.enabled: 792/792 passed, same count and coverage (92.73% lines) as before migration
  • vp run -r build: CLI and docs (Astro on Vite+ core) build; CLI externals unchanged (backlog-js, commander, consola, open, valibot)
  • Packed tarball installed with npm on Node 20.20 and bee --version / --help / issue --help run
  • vp run --filter @nulab/bee generate:skill:check passes
  • Pre-commit hook (vp staged) ran on both commits
  • vp env current resolves Node 24 and pnpm 10.30.3 from devEngines at the root and in apps/cli
  • CI green on this PR (first run of setup-vp)

🤖 Generated with Claude Code

lollipop-onl and others added 2 commits September 29, 2026 00:31
The repo stitched together turbo, oxlint, oxfmt, vitest, unbuild, lefthook
and mise, each with its own config file, version pin and CI setup step.
Vite+ ships the same Oxc tools plus Vitest, tsdown and a task runner behind
one `vp` binary and one `vite.config.ts`, so a single dependency and a
single setup action now cover what seven tools did.

Decisions that are not obvious from the diff:

- `tsc --noEmit` is replaced by `lint.options.typeCheck` (tsgolint on
  TypeScript 7). Turning on `typeAware` for it also switched on category
  rules that had never run; the ones flagging established patterns are
  turned off to keep this a toolchain swap, and the two trivial hits are
  fixed instead.
- The shared `vi.clearAllMocks()` setup file is gone because Vitest 5 makes
  `clearMocks` the default. `@repo/test-utils` drops its vitest peer
  dependency: pnpm's auto-installed peer gave it a second vite-plus
  instance, so the runner could not clear the consola mocks it created.
- unbuild needed a hook to bundle `@repo/*` while keeping `dependencies`
  external; that is tsdown's default, so the hook and the typescript 6
  override it forced are removed. The `BodyInit` shim for hey-api is
  removed too: nothing references it and tsgolint rejects the duplicate.
- Vite+ cannot run on Node 20, so the test matrix drops it. `engines.node`
  still promises Node 20, so CI now packs the CLI and installs it globally
  on Node 20/22/24 as the smoke test, which also exercises the published
  dependency list rather than the workspace.
- apps/docs stays outside lint and type check, as it was in CI before:
  Astro's virtual module types only exist after `astro sync`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`.node-version` and `packageManager` split the dev environment across two
places, and `packageManager` is Corepack's field while `vp` now manages
both tools. `devEngines` is the standard field for development-time
requirements, and `vp` and setup-vp both read it, so CI no longer needs
`node-version-file`.

The runtime range is `^22.18.0 || ^24.11.0` rather than just 24: the CI
test matrix still runs Node 22, and `onFail: "error"` would otherwise
reject it. Both bounds are Vite+'s own minimums, and `vp` resolves the
range to the newest 24.x for local work.

apps/cli repeats `devEngines.runtime` because `vp` resolves the nearest
package.json first, and there `engines.node` (`>=20.18`, the published
support range) would pick the dev runtime -- on a fresh machine, the
newest Node overall.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lollipop-onl lollipop-onl self-assigned this Sep 28, 2026
@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 92.73% 1940 / 2092
🔵 Statements 92.94% 2029 / 2183
🔵 Functions 92.85% 455 / 490
🔵 Branches 80.57% 842 / 1045
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/cli-utils/src/output.ts 100% 100% 100% 100%
packages/config/src/config.ts 100% 75% 100% 100%
packages/test-utils/src/command-test.ts 100% 100% 100% 100%
packages/test-utils/src/mock-consola.ts 100% 100% 100% 100%
packages/test-utils/src/process.ts 33.33% 100% 0% 50% 5
packages/test-utils/src/stdout.ts 100% 50% 100% 100%
Generated in workflow #531 for commit e75e34a by the Vitest Coverage Report Action

@lollipop-onl
lollipop-onl merged commit bc7d513 into main Sep 28, 2026
10 checks passed
@lollipop-onl
lollipop-onl deleted the lollipop-onl/chore-vite-plus-toolchain branch September 28, 2026 16:21
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