Fix demo version badge - #13
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
The live demo advertised v2.5.0 while actually running 3.0.0. The version
was hardcoded in two places and had gone stale across three releases (2.6.x,
3.0.0, 3.1.0). This derives it from the demo's own
package.jsoninstead, andbrings the pinned dependency up to the newest published version.
Why it drifted
Two independent string literals, neither connected to anything:
Nothing failed when they fell behind — no test asserted them, and the page
rendered fine being wrong. Correcting the numbers would have reset the clock
without fixing the mechanism, so the badge now reads the value it is describing:
Both badges consume that constant, so the displayed version and the installed
one cannot disagree. Bumping the dependency is now the only edit needed to
update the page.
Changes
demo/src/version.tsdemo/src/App.tsxdemo/src/Hero.tsxdemo/package.json3.0.0→3.1.0.demo/package-lock.jsonThe lockfile diff is four lines confined to the tablecraft entry — zero
packages added or removed.
Why not read it from the package itself?
import { version } from '@marvinackerman/tablecraft/package.json'would be themore direct source, but tablecraft's
exportsmap has no./package.jsonentry,so it fails under exports enforcement. Adding one would widen the published
package's public surface to serve a demo badge, which isn't a trade worth making.
The demo's own pin is an exact version, so it's an accurate stand-in.
Testing
Checked the built bundle rather than trusting the source:
3.1.0appears once,2.5.0appears zero times. Vite tree-shakespackage.jsondown to just thedependenciesobject, so no other manifest fields (scripts, devDependencies)reach the client.
Notes
The badge will read
v3.1.0, notv3.2.0. 3.2.0 exists in the repo but isnot on npm, and the demo installs from the registry — pinning an unpublished
version would fail the install and turn demo CI red. Once 3.2.0 is published,
bumping the single line in
demo/package.jsonupdates both badges automatically.This is deliberately separate from the
feat-faceted-filtersPR. It touchesonly
demo/and has nothing to do with faceted filters; keeping it apart meansneither review has to step around the other.