fix: prevent empty Vite 8 stats from breaking the build#184
Merged
Conversation
No stable Vite 8 release exists yet, so the stats generator wrote an empty array to data/vite-version-stats.json, which TypeScript infers as never[] and breaks every chart component (vp check failure in the Update Vite Stats workflow). - Add a typed apps/dashboard/src/data/viteStats.ts wrapper so empty data type-checks as ViteStat[] instead of never[] - Point all stats importers at the typed module - Skip writing the stats file when no versions are collected so existing tracked data isn't clobbered until Vite 8 ships
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
Update Vite Statsworkflow (failing run) runsvp run generate→vp check --fix. Since commit bf33f4a,tools/override-vite.mjstargets stable Vite 8 releases (/^8\.\d+\.\d+$/). No stable Vite 8 exists on npm yet, sogeneratewrites an empty[]todata/vite-version-stats.json. With an empty array, TypeScript infers the JSON import asnever[], so everystat.version/stat.buildTimeaccess fails (Property 'X' does not exist on type 'never') andvp checkerrors out.Fix
apps/dashboard/src/data/viteStats.tsthat casts the JSON toViteStat[], so empty data type-checks instead of collapsing tonever[].BuildTimeChart,BundleSizeChart,StatsCards,ViteStatsPage) at the typed module.Verified
vp checkandvp run buildpass, including a simulated empty-data ([]) run.