Skip to content

TS rewrite + Migrate build tooling from Vite to tsdown#46

Merged
bartveneman merged 8 commits intomainfrom
claude/replace-vite-tsdown-x3baW
Mar 8, 2026
Merged

TS rewrite + Migrate build tooling from Vite to tsdown#46
bartveneman merged 8 commits intomainfrom
claude/replace-vite-tsdown-x3baW

Conversation

@bartveneman
Copy link
Member

Summary

This PR replaces the Vite build system with tsdown, a more lightweight and specialized tool for building TypeScript/JavaScript libraries. The migration simplifies the build configuration and removes unnecessary build-related CI steps.

Key Changes

  • Removed Vite configuration: Deleted vite.config.js which defined library build settings, entry points, and external dependencies
  • Added tsdown configuration: Created tsdown.config.js with equivalent build settings including ESM format, TypeScript definitions generation, and publint validation
  • Updated build script: Changed package.json build command from vite build to tsdown
  • Removed lint-package CI job: Eliminated the separate GitHub Actions workflow step that ran npm run build followed by publint, as tsdown now handles publint validation internally
  • Updated dependencies: Removed vite and vite-plugin-dts dev dependencies, added tsdown and publint as direct dev dependencies

Notable Details

  • The build output configuration remains functionally equivalent (ESM format, same entry points)
  • External dependency handling (@projectwallace/css-analyzer) is preserved in the new configuration
  • TypeScript definitions generation is maintained via tsdown's built-in dts option
  • Package linting is now integrated into the build process rather than being a separate CI step

https://claude.ai/code/session_01VzmRVmcLD7znsBCH2V5Hg7

claude and others added 8 commits March 8, 2026 15:15
- Swap vite + vite-plugin-dts for tsdown (with publint peer dep)
- Add tsdown.config.js: ESM format, neutral platform (isomorphic), dts
  generation, publint enabled, deps.neverBundle for external dep,
  outExtension preserving .js file extensions
- Remove vite.config.js
- Update build script to `tsdown`
- Remove lint-package CI job (publint now runs as part of the build)

https://claude.ai/code/session_01VzmRVmcLD7znsBCH2V5Hg7
tsdown automatically excludes package.json dependencies from bundling,
so explicitly listing @projectwallace/css-analyzer is unnecessary.

https://claude.ai/code/session_01VzmRVmcLD7znsBCH2V5Hg7
Source files:
- Convert all src/*.js → src/*.ts with proper TypeScript types
- Add src/types.ts with shared Analysis, GuardResult, and Guard types
- Annotate all guard functions with Analysis parameter type
- Replace JSDoc @param annotations with TypeScript types
- Remove @ts-expect-error in complexity.ts (use 'as Specificity' cast instead)
- Keep @ts-expect-error in index.ts for overloaded analyze() return type mismatch

Test files:
- Convert all src/*.test.js → src/*.test.ts
- Replace uvu (suite/assert) with vitest (describe/it/expect)
- Remove uvu .run() calls; wrap tests in describe() blocks

Config:
- package.json: replace uvu with vitest, update test script to vitest run
- tsconfig.json: remove allowJs/checkJs (pure TypeScript now), update include to .ts
- tsdown.config.js: update entry points to .ts

https://claude.ai/code/session_01VzmRVmcLD7znsBCH2V5Hg7
Replace 'latest' with installed semver ranges for publint, tsdown,
and vitest to ensure reproducible installs.

https://claude.ai/code/session_01VzmRVmcLD7znsBCH2V5Hg7
@codecov-commenter
Copy link

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@bartveneman bartveneman merged commit c9191f3 into main Mar 8, 2026
5 checks passed
@bartveneman bartveneman deleted the claude/replace-vite-tsdown-x3baW branch March 8, 2026 19:58
@bartveneman bartveneman mentioned this pull request Mar 8, 2026
@bartveneman bartveneman changed the title Migrate build tooling from Vite to tsdown TS rewrite + Migrate build tooling from Vite to tsdown Mar 8, 2026
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.

3 participants