Skip to content

chore: retire in-Storybook docs, wire Storybook <-> docs links#1245

Open
Fabian Hüske (fabianhueske) wants to merge 5 commits into
mainfrom
chore/storybook-docs-cleanup
Open

chore: retire in-Storybook docs, wire Storybook <-> docs links#1245
Fabian Hüske (fabianhueske) wants to merge 5 commits into
mainfrom
chore/storybook-docs-cleanup

Conversation

@fabianhueske

Copy link
Copy Markdown
Contributor

What?

Retires the custom documentation layer that lived inside Storybook and establishes a clear split:

  • meteor.shopware.com (apps/docs) is the single source of documentation.
  • Storybook (packages/component-library) becomes a component playground + auto-generated API docs only.

The two now cross-link per component: every docs component page links out to its Storybook page, and every Storybook component view links back to its docs page.

Storybook (packages/component-library)

  • Removed all custom docs MDX (component pages, foundations, getting-started), the src/docs/_components React helpers, preview-head.html docs styling, STORYBOOK_DOCS_STANDARD.md, remark-gfm, and the now-unused @storybook/blocks dep.
  • Relies on global autodocs for every component; simplified main.ts/preview.ts and fixed a stale storySort order.
  • Added a dynamic toolbar Documentation button that links the active component to its meteor.shopware.com page (declared @storybook/components + @storybook/icons, which were previously phantom deps).
  • Switched the brand logo to the shared shopware-meteor-logo.svg and the brand link to meteor.shopware.com; dropped the old absolute vercel logo URLs.

Docs (apps/docs)

  • Added a per-component Storybook button in the page header (between Source and Copy page), using a new i-custom:storybook icon.
  • Moved inset from /components to /utilities/components (it's a layout utility, like theme-provider).
  • Replaced the hard-coded section-root redirects with a middleware that resolves the first sidebar entry from the live navigation tree.

Why?

  • The docs content was duplicated: fully authored in apps/docs and as MDX inside Storybook. Maintaining two copies is error-prone, and Storybook's custom docs styling/standards added upkeep with no payoff now that the docs site exists.
  • Users need one canonical documentation destination, with Storybook reachable for live component playground/testing — hence the bidirectional links.
  • The hard-coded section redirects (/components/components/action-menu, etc.) silently broke whenever the sidebar was reordered or a higher-sorted page was added, pointing users at the wrong page.

How?

  • Autodocs: deleting the MDX overrides lets Storybook's global tags: ["autodocs"] generate a default docs page per component. addon-essentials provides docs; the split addon-docs + remark-gfm setup (only needed for MDX tables) was removed.
  • Storybook → docs link: a small manager addon reads the active entry via useStorybookApi().getCurrentStoryData() (re-rendering on navigation) and maps Components/<Name>meteor.shopware.com/components/<kebab-slug>; non-component views fall back to the docs home.
  • Docs → Storybook link: a computed URL maps the docs slug to storybook.meteor.shopware.com/?path=/docs/components-<slug> (Storybook auto-resolves the shortened path to the component's autodocs). Gated on the same componentSourcePaths map as the existing GitHub button so the two buttons pair up.
  • Dynamic redirects: app/middleware/section-redirect.global.ts queries queryCollectionNavigation('docs'), finds the node for the requested section path, walks to its first leaf, and issues a 302. This replaces the entire routeRules redirect block and always tracks the sidebar's actual order.

Testing?

  • nuxt typecheck (docs): 0 errors. eslint (component-library): 0 errors. prettier --check: clean in both packages.
  • build:storybook succeeds; 45 autodocs pages generated (one per component).
  • Verified in a headless browser (Playwright):
    • Storybook toolbar Documentation button resolves per-component (e.g. Badge → /components/badge) and falls back to home on directives.
    • Docs Storybook button renders between Source and Copy page, resolves per-component, is absent on non-component pages, and the custom icon displays in light and dark mode.
    • Brand logo loads via the relative path (no 404).
  • Verified redirects on a running dev server:
    • /components/components/action-menu, /documentation.../getting-started/installation
    • /utilities/utilities/components/inset, /utilities/composables.../use-future-flags (previously hard-coded to the wrong use-snackbar)
    • /components/inset → 404 (moved), /components/badge → 200 (leaf pages untouched)
  • Cross-referenced library ↔ docs ↔ Storybook: all visible /components/ pages have matching Storybook pages; data-table-filter and segmented-control are intentionally hidden internal companions.

Anything Else?

  • Deployment prerequisites (blocking): storybook.meteor.shopware.com must serve this Storybook, and meteor.shopware.com must host apps/docs, for the cross-links to resolve. Both are the assumed hosts in app.config.ts / shopwareTheme.js.
  • Known follow-ups (non-blocking):
    • Storybook → docs back-links only cover Components/*; Directives/Tooltip (and future composable stories) currently link to the docs home rather than /utilities/....
    • The redirect middleware and the docs link logic assume the docs collection with no locale prefix; would need adjusting if docs i18n is enabled.
  • 302 (not 301) is used for the dynamic redirects on purpose, since the computed target can change and must not be hard-cached by browsers.
  • The dependabot vulnerability notice shown on push is a pre-existing repo-wide alert on main, unrelated to this branch.

Storybook becomes a component playground + autodocs only; meteor.shopware.com
(apps/docs) is the single documentation site. They cross-link per component.

Storybook (packages/component-library):
- Remove all custom docs MDX (components, foundations, getting-started),
  the _components React helpers, preview-head.html styling, remark-gfm,
  @storybook/blocks, and STORYBOOK_DOCS_STANDARD.md
- Rely on global autodocs; simplify main.ts/preview.ts; fix stale storySort
- Add a dynamic toolbar 'Documentation' button linking each component to its
  meteor.shopware.com page (declare @storybook/components + @storybook/icons)
- Use the shared shopware-meteor-logo.svg; drop old vercel logo URLs

Docs (apps/docs):
- Add a per-component 'Storybook' header button (custom i-custom:storybook icon)
- Move inset to /utilities/components (layout utility, like theme-provider)
- Replace hard-coded section redirects with section-redirect.global.ts, which
  resolves the first sidebar entry from the live navigation tree
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
meteor-docs Ready Ready Preview, Comment Jul 2, 2026 2:53pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
meteor-component-library Ignored Ignored Preview Jul 2, 2026 2:53pm

Request Review

@pkg-pr-new

pkg-pr-new Bot commented Jul 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

@shopware-ag/meteor-admin-sdk

npm i https://pkg.pr.new/shopware/meteor/@shopware-ag/meteor-admin-sdk@1245

@shopware-ag/meteor-component-library

npm i https://pkg.pr.new/shopware/meteor/@shopware-ag/meteor-component-library@1245

@shopware-ag/create-meteor-extension

npm i https://pkg.pr.new/shopware/meteor/@shopware-ag/create-meteor-extension@1245

@shopware-ag/meteor-icon-kit

npm i https://pkg.pr.new/shopware/meteor/@shopware-ag/meteor-icon-kit@1245

@shopware-ag/meteor-prettier-config

npm i https://pkg.pr.new/shopware/meteor/@shopware-ag/meteor-prettier-config@1245

@shopware-ag/stylelint-plugin-meteor

npm i https://pkg.pr.new/shopware/meteor/@shopware-ag/stylelint-plugin-meteor@1245

@shopware-ag/meteor-tokens

npm i https://pkg.pr.new/shopware/meteor/@shopware-ag/meteor-tokens@1245

commit: eaafcd1

…llback

- Detect section roots from the navigation tree instead of a hard-coded path
  regex, so new top-level (or nested) sections redirect automatically
- Add a fallback map for the header-linked roots so they never 404 if the
  navigation tree can't be loaded (e.g. transient content failure)
- Drop the redundant redirect comment from nuxt.config.ts (the middleware is
  self-documenting)
… links

- Read the navigation tree Docus already fetched via useNuxtData instead of
  fetching a second copy under a separate key (avoids serialising the whole
  nav tree into the payload twice on every docs page); query directly only as
  an SSR fallback
- Extract shared componentSlug/componentSourcePaths computeds so the GitHub and
  Storybook link builders no longer duplicate the route guard and source lookup
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.

2 participants