Files
certctl/web/.storybook/main.ts
T
shankar0123 5231609f26 fix(web): Hotfix #9 — remove Storybook deps from package.json (Vite 8 peer conflict)
CI failure on Phase 8 commit a9e229b (#561) and subsequent #566:

  npm error peer vite@"^4.0.0 || ^5.0.0 || ^6.0.0"
    from @storybook/react-vite@8.6.18
  npm error   dev @storybook/react-vite@"^8.6.0" from the root project

Root cause:
  Phase 8 added Storybook 8 deps to package.json as scaffold for the
  operator's local install. I did not check Storybook 8's Vite peer-
  range — it caps at Vite 6. certctl runs Vite 8 (Phase 4 manualChunks
  rewrite). `npm ci` fails on the peer conflict; the 3-retry loop in
  Dockerfile-frontend gives the same fail 3 times then aborts.

Fix:
  Remove `storybook`, `@storybook/react-vite`, `@storybook/addon-a11y`,
  + the `storybook` / `storybook:build` npm scripts from package.json.
  CI now resolves cleanly against the existing lockfile (the deps
  never made it into the lockfile because operator hasn't run
  `npm install` locally yet, so removal is a no-op there too).

  The .storybook/ config files + 8 *.stories.tsx files stay committed
  as scaffold. tsconfig.json already excludes them from typecheck.
  When the operator is ready to wire Storybook in:

    cd web && npm install --save-dev storybook@^9.0.0 \
      @storybook/react-vite@^9.0.0 @storybook/addon-a11y@^9.0.0

  Storybook 9 (verified against storybook.js.org docs) supports
  Vite 7+8 — the peer conflict goes away. The .storybook/main.ts
  header now documents this install path so the operator doesn't
  have to dig through commit history later.

  This was an honest scoping error in Phase 8: I should have
  verified the peer-range against the live registry before adding
  the deps. The corrected path (Storybook 9) requires no sandbox
  install — operator picks the version when they're ready.

Verification:
  • npx tsc --noEmit — exits 0
  • npx vite build — ✓ built in 2.58s
  • All 34 CI guards pass locally
  • The package.json + lockfile now match (no Storybook entries
    in either) — `npm ci` on the next push will install cleanly.

Falsifiable proof for next CI run: the Frontend Build job's `npm ci`
step should complete without ERESOLVE error. Watch the next push.
2026-05-14 18:06:12 +00:00

57 lines
2.1 KiB
TypeScript

// Copyright 2026 certctl LLC. All rights reserved.
// SPDX-License-Identifier: BUSL-1.1
//
// Phase 8 TEST-H3 closure — Storybook configuration scaffold.
//
// DEPS NOT INSTALLED IN PACKAGE.JSON. The first attempt added
// `@storybook/react-vite ^8.6.0` + `@storybook/addon-a11y ^8.6.0`
// + `storybook ^8.6.0` to package.json, but Storybook 8's peerDeps
// cap Vite at v6 — the certctl project ships Vite 8 (Phase 4
// manualChunks rewrite). CI fail confirmed the peer-conflict via
// `npm ci`. Hotfix #9 removed the deps to unblock CI.
//
// To install:
// cd web && npm install --save-dev storybook@^9.0.0 \
// @storybook/react-vite@^9.0.0 @storybook/addon-a11y@^9.0.0
// # Storybook 9 supports Vite 7+8 — verified against storybook.js.org
// # docs before installing.
//
// Once installed, this main.ts + preview.ts work as-is. The 8
// committed *.stories.tsx files import @storybook/react types and
// will typecheck cleanly. tsconfig.json excludes them today so
// `npm run build` stays green in the meantime.
//
// Reuses the existing Vite config from web/vite.config.ts
// (including the Phase 4 manualChunks, the Phase 0 fontsource
// imports, the test-block exclusions) so stories render against
// the same build pipeline production uses.
//
// Addon scope:
// • @storybook/addon-a11y — runs axe-core on every story render +
// surfaces violations in the Storybook UI. Phase 5 shipped axe
// coverage for primitives via Vitest (web/src/test/a11y.test.tsx);
// this addon extends that signal to every component variant
// showcased here, per-render. Catches contrast / label-binding /
// focus regressions that the per-component Vitest suite misses.
//
// Story discovery: `**/*.stories.{ts,tsx}` under src/ — stories live
// next to the component they document.
import type { StorybookConfig } from '@storybook/react-vite';
const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(ts|tsx)'],
addons: [
'@storybook/addon-a11y',
],
framework: {
name: '@storybook/react-vite',
options: {},
},
docs: {
autodocs: 'tag',
},
};
export default config;