Skip to content

Migrate to vite+ #315

@northword

Description

@northword

Vite+ can cover node version management, dependency management (auto selecting the appropriate package manager based on repo config, default pnpm), task running (executing preset commands and package.json#scripts), lint (based on oxlint), format (based on oxfmt), ts check (based on tsgo), commit hook + lint staged, and so on. The infra for dev is almost fully covered by Vite+—except for development, building, and publishing, which still require scaffold.

We seem to be able to migrate the basic infra config of the repository to Vite+, in order to:

  • Reduce the number of scattered configuration files (eslint.config.mjs, .prettierrc, .prettierignore, .husky/*, package.json#lint-staged, etc.)
  • Centralize almost all basic setup configurations in one file (vite.config.ts)
  • Have a simpler configuration — especially for oxlint, which includes a large number of practical rules without the need for a super complex eslint configuration

In addition to dependency update, we also need to update the VSCode configuration (.vscode/*.json) to recommend the Vite Plus Extension Pack rather than vscode-eslint + prettier.

It should be noted that we cannot use the dev and build capabilities provided by Vite, since plugin development and building are handled by scaffold. However, if users are using a frontend framework, they can use Vite's capabilities to bundle the framework.
We may need to emphasize using vp run dev and vp run build instead of vp dev and vp build. This is probably the easiest place in the entire system to cause confusion and misunderstanding.
(This raises a question: is it feasible and necessary to convert scaffold into a Vite plugin?)

In addition, users can use the testing capabilities provided by Vite+ (based on vitest) to test code that does not depend on Zotero's private API.

And for the open-source license, vite+ finally chose the MIT license, which has no commercial restrictions and no other requirements.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions