feat: Migration to Vite+#2745
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/mantine
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
commit: |
Summary
First of all, apologies for the massive file diff. It was unfortunately unavoidable as every
package.jsonfile in the repo has had itsvitedep swapped withvite-plus, and every unit test file'svitestimport path has also been changed tovite-plus/test.With that out of the way, here's a breakdown of what the migration involves:
Dev server & building
Basically nothing has changed here. We were already using Vite for this and we are still using Vite, so our existing scripts and configs work out of the box.
Linting & formatting
We were using ESLint and Prettier for this, which have been swapped out for oxlint and oxfmt as part of Vite+. The new formatting is almost the same as before, though you will still see some formatting changes in the diff. These fall into 3 categories:
htmlToMarkdown.tsfor example. This file was not formatted properly, evident by things like{return ...;}.docsfiles. These were due to NextJS having its own opinionated formatting that took priority over the root Prettier config. Now, everything uses the same format provided by Vite+.docsReact components. Vite+ comes with Tailwind class ordering built-in, which uses a slightly different order to the Prettier plugin we were using. Can probably be configured, haven't looked into it because the component files are reformatted anyway per the previous category.One major caveat here is that some important ESLint rules we were using do not have equivalents in oxlint, namely these:
import/no-cycleimport/no-extraneous-dependenciesimport/extensionsTesting
Our unit tests are pretty much unchanged as we were already using Vitest (short of import paths). The only issue I'm running into is with the Vitest VSCode extension which seems to not be running the setup code, as snapshots have randomized block IDs. Running the
testscript seems to work fine though.For e2e tests, I haven't converted our Playwright tests to Vitest Browser Mode yet. This PR is already kind of huge and I don't want to inflate the diff even more, so that will come in a separate PR, as there will be quite a bit to go over there.
Monorepo scripts & releases
The majority of monorepo functionality, i.e. using a single script to run multiple scripts across packages, is now handled by Vite Task as opposed to NX. This should also include caching of script results, though this seems to not be working atm.
NX has not been removed entirely as Vite+ doesn't include tools for releasing to npm, so
nx releaseis still used for this.Rationale
Vite+ should simplify and speed up our tooling a lot. It employs pretty much the same stack we are already using for the block-view project, and it's worked well for us there.
Simplification
Vite+ bundles together DX, bundling, testing, and more that is currently split between:
Speedup
Vite+ uses oxlint and oxfmt for linting & formatting which are rust based and substantially faster than ESLint and Prettier.
Additionally, Vitest Browser Mode should also speed up our e2e tests quite a bit vs Playwright (will be done in a separate PR though).
Changes
See above for general changes.
There are also a few specific changes that are worth explaining:
.nvmrchas been renamed to.node-version. It still does the same thing, but is recognized by a variety of applications and not just NVM..vite-hooks/pre-commitis auto added by the Vite+ migration utility.nx.jsonhas been heavily cut down as it is not only responsible for releases - other functionality is handled by Vite Task.vite-plusis given the version range"catalog:", which ensures the same version is used across packages.packages/dev-scripts/gen.tshas had its JSON serialization updated to match oxfmt formatting.Impact
See summary.
Testing
See summary.
Screenshots/Video
N/A
Checklist
Additional Notes
Things to consider/fix: