Skip to content

Fix demo version badge - #13

Merged
Marvinkwame merged 5 commits into
mainfrom
fix-demo-version-badge
Sep 10, 2026
Merged

Marvinkwame merged 5 commits into
mainfrom
fix-demo-version-badge

Conversation

@Marvinkwame

Copy link
Copy Markdown
Owner

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.json instead, and
brings the pinned dependency up to the newest published version.

Why it drifted

Two independent string literals, neither connected to anything:

demo/src/App.tsx:20   <span …>v2.5.0 · MIT</span>
demo/src/Hero.tsx:33  <span className="text-faint">v2.5.0</span>

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:

// demo/src/version.ts
import pkg from '../package.json'

export const TABLECRAFT_VERSION = pkg.dependencies['@marvinackerman/tablecraft']

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

File Change
demo/src/version.ts New. Derives the version from the demo's dependency pin.
demo/src/App.tsx Nav badge uses the constant.
demo/src/Hero.tsx Hero badge uses the constant.
demo/package.json Pin 3.0.03.1.0.
demo/package-lock.json Synced with the new pin.

The 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 the
more direct source, but tablecraft's exports map has no ./package.json entry,
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

demo tsc --noEmit   clean
demo vite build     ✓ built in 6.01s, 63 modules
demo tests          5 passed

Checked the built bundle rather than trusting the source: 3.1.0 appears once,
2.5.0 appears zero times. Vite tree-shakes package.json down to just the
dependencies object, so no other manifest fields (scripts, devDependencies)
reach the client.

Notes

The badge will read v3.1.0, not v3.2.0. 3.2.0 exists in the repo but is
not 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.json updates both badges automatically.

This is deliberately separate from the feat-faceted-filters PR. It touches
only demo/ and has nothing to do with faceted filters; keeping it apart means
neither review has to step around the other.

@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tablecraft Ready Ready Preview Sep 10, 2026 7:42am UTC
tablecraft-g1vu Ready Ready Preview Sep 10, 2026 7:42am UTC

@Marvinkwame
Marvinkwame merged commit 6492d53 into main Sep 10, 2026
9 checks passed
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.

1 participant