@blakesteve/roster 4.6.1 → 4.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -563,6 +563,40 @@ Output in `dist/`:
563
563
  | `tokens.css` | Design token CSS variables |
564
564
  | `preflight.css` | Optional global reset (see Setup) |
565
565
  | `index.d.ts` | TypeScript definitions |
566
+ | `meta.json` | Test count and version, written when the tarball is built |
567
+
568
+ ### What `meta.json` is for
569
+
570
+ Consumers read this package to describe it. blakeb.dev's case study takes the
571
+ version from `package.json` and counts components by parsing the exports out of
572
+ `dist/*.d.ts`, so both stay correct on their own.
573
+
574
+ The test count has no such source. `files` is `["dist"]`, so the suite never
575
+ leaves this repo, and the number on that page was a hand-typed literal that
576
+ drifted two minor versions behind while sitting next to a live one.
577
+
578
+ `scripts/write-meta.mjs` writes it from a real `vitest run`, wired to `prepack`
579
+ rather than `build` — the suite is slow enough that charging every local build
580
+ for it would be a tax on the wrong people, and the only moment the number has to
581
+ be right is when the tarball is built. A static count of `it(` would not work
582
+ anyway, because `it.each` expands at runtime.
583
+
584
+ `prepack` and not `prepublishOnly`, which was the first attempt. The latter
585
+ fires only on `npm publish`, so its output cannot be inspected without
586
+ publishing — and 4.6.1 went out with the script committed, the hook wired, and
587
+ `meta.json` nowhere in the tarball. Under `prepack`, `npm pack` produces the
588
+ real artifact and the question is answerable in a second:
589
+
590
+ ```bash
591
+ npm pack --pack-destination /tmp
592
+ tar -tzf /tmp/blakesteve-roster-*.tgz | grep meta.json
593
+ ```
594
+
595
+ It refuses to write a zero. A runner that collected nothing reports zero passing
596
+ rather than failing, and "live · 0 tests" would look authoritative while being
597
+ the worst possible answer. `src/write-meta.test.ts` pins that guard and the
598
+ field selection, including the one that bit first: `numTotalTestSuites` reads
599
+ like a file count but counts `describe` blocks — 166 against 92 real files.
566
600
 
567
601
  ## Contributing
568
602
 
package/dist/meta.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "version": "4.6.2",
3
+ "tests": 1000,
4
+ "testFiles": 93
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blakesteve/roster",
3
- "version": "4.6.1",
3
+ "version": "4.6.2",
4
4
  "description": "A production-grade atomic component library: accessible, theme-aware, and documented in Storybook. React 19, TypeScript, Tailwind CSS v4.",
5
5
  "keywords": [
6
6
  "react",
@@ -61,7 +61,8 @@
61
61
  "test:ui": "vitest --ui",
62
62
  "test:run": "vitest run",
63
63
  "check:prefix": "node scripts/check-prefix.mjs",
64
- "check:classes-emit": "node scripts/check-classes-emit.mjs"
64
+ "check:classes-emit": "node scripts/check-classes-emit.mjs",
65
+ "prepack": "npm run build && node scripts/write-meta.mjs"
65
66
  },
66
67
  "peerDependencies": {
67
68
  "react": "^19.2.0",