Skip to content

feat: configure Storybook to use package README.md as documentation s…#745

Merged
tomaszpacior merged 4 commits intomainfrom
feature/add-readme-to-blocks-to-storybook
Feb 26, 2026
Merged

feat: configure Storybook to use package README.md as documentation s…#745
tomaszpacior merged 4 commits intomainfrom
feature/add-readme-to-blocks-to-storybook

Conversation

@tomaszpacior
Copy link
Copy Markdown
Contributor

@tomaszpacior tomaszpacior commented Feb 26, 2026

What does this PR do?

-Use package-level README.md files as Storybook documentation

Summary by CodeRabbit

  • New Features

    • Storybook autodocs enabled across many blocks: README content now appears in component docs, with a new global docs page and updated default story templates for consistent rendering.
  • Chores

    • package manager updated to npm@11.11.0.
    • Vite client types added to TypeScript config.
    • Published minor version bumps for multiple block packages.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ba0c035 and b506bdc.

📒 Files selected for processing (1)
  • packages/blocks/category/src/frontend/Category.client.stories.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/blocks/category/src/frontend/Category.client.stories.tsx

Walkthrough

Adds Storybook autodocs integration (imports package READMEs into story metadata and a custom docs.page), updates npm toolchain version, adds Vite ambient types to TypeScript config, introduces a story generator/template, and records package changes via a changeset.

Changes

Cohort / File(s) Summary
Package manifest
package.json
Bumped packageManager from npm@11.10.1npm@11.11.0.
TypeScript config
packages/configs/typescript-config/frontend.json
Added "types": ["vite/client"] to compilerOptions to include Vite ambient typings.
Changeset
.changeset/rare-paths-leave.md
Added changeset noting minor version bumps for many block packages and Storybook README usage.
Storybook preview
.storybook/preview.tsx
Added ReadmeDocsPage and set preview.docs.page to render README content from story/meta parameters.
Generator config & template
turbo/generators/config.ts, turbo/generators/templates/block/frontend/stories.hbs
Added generation step and a new frontend story template that scaffolds a .client.stories.tsx with autodocs/readme wiring and default story exports.
Story files (autodocs metadata)
Blocks stories
packages/blocks/.../*.client.stories.tsx (e.g., article-list, article-search, article, bento-grid, category*, cta-section, document-list, faq, feature-section*, featured-service-list, hero-section, invoice-list, media-section, notification-*, order-*, orders-summary, payments-*, pricing-section, product-*, quick-links, recommended-products, service-*, surveyjs-form, ticket-*, ticket-recent, ticket-summary, user-account)
Imported ../../README.md?raw into many stories and added tags: ['autodocs'] and parameters: { readme } to exported story meta. A few files also add type Story = StoryObj<typeof meta> and/or default Default story exports. Changes are metadata/documentation-only (Storybook integration).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • marcinkrasowski

Poem

🐇 I nibble README crumbs with cheer,

I stitch them into stories here,
Templates hum and docs take flight,
Storybook beams through day and night,
A hopping rabbit claps — hooray! 🎉

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is minimal and lacks required sections (Related Ticket, Key Changes, How to test, Media). While it states the purpose, it fails to follow the repository's template structure and provide sufficient detail for review. Add Related Ticket, expand Key Changes to explain what was modified and side effects, include How to test section with setup and testing steps, and add Media if applicable.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: configuring Storybook to use package README.md files as documentation source, which aligns with the changeset and file modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/add-readme-to-blocks-to-storybook

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/blocks/ticket-summary/src/frontend/TicketSummary.client.stories.tsx (1)

71-73: ⚠️ Potential issue | 🟡 Minor

Malformed JWT token in story args.

The JWT token appears to have a typo in its payload. The base64 segment contains fSWiaWF0 which decodes to }"iat - there's a missing comma before "iat" in the JSON payload. This produces invalid JSON.

Compare with the valid tokens in other story files (e.g., TicketList) which have fSwiaWF0 (lowercase 'w') that correctly decodes to },"iat.

🔧 Suggested fix
         accessToken:
-            'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSmFuZSBEb2UiLCJlbWFpbCI6ImphbmVAZXhhbXBsZS5jb20iLCJyb2xlIjoic2VsZnNlcnZpY2Vfb3JnX2FkbWluIiwiY3VzdG9tZXIiOnsiaWQiOiJjdXN0LTAwMSIsInJvbGVzIjpbInNlbGZzZXJ2aWNlX29yZ191c2VyIiwic2VsZnNlcnZpY2Vfb3JnX3VzZXIiLCJzZWxmc2VydmljZV9vcmdfYWRtaW4iXSwibmFtZSI6IkFjbWUgQ29ycG9yYXRpb24ifSWiaWF0IjoxNzU2MzI0NTg0fQ.wFAXi1DbgN67z8xQcqZdGz9YeAolbim3lecVIzV2rv0',
+            'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSmFuZSBEb2UiLCJlbWFpbCI6ImphbmVAZXhhbXBsZS5jb20iLCJyb2xlIjoic2VsZnNlcnZpY2Vfb3JnX2FkbWluIiwiY3VzdG9tZXIiOnsiaWQiOiJjdXN0LTAwMSIsInJvbGVzIjpbInNlbGZzZXJ2aWNlX29yZ191c2VyIiwic2VsZnNlcnZpY2Vfb3JnX3VzZXIiLCJzZWxmc2VydmljZV9vcmdfYWRtaW4iXSwibmFtZSI6IkFjbWUgQ29ycG9yYXRpb24ifSwiaWF0IjoxNzU2MzI0NTg0fQ.SIGNATURE_HERE',

Note: You'll need to regenerate the signature after fixing the payload.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/blocks/ticket-summary/src/frontend/TicketSummary.client.stories.tsx`
around lines 71 - 73, The accessToken string in the story args is a malformed
JWT (payload base64 contains `fSWiaWF0` -> `}"iat` missing a comma) causing
invalid JSON; update the payload segment to match the correct encoding used in
other stories (replace the uppercase typo with the correct lowercase sequence,
e.g., make it consistent with `fSwiaWF0`) so the payload decodes to `},"iat`,
then re-sign/regenerate the JWT signature and replace accessToken in the
TicketSummary.story args (look for the accessToken property in
TicketSummary.client.stories.tsx) with the newly signed token.
🧹 Nitpick comments (4)
packages/blocks/payments-history/src/frontend/PaymentsHistory.client.stories.tsx (1)

13-25: Consider extracting shared Storybook docs config to a helper.

This parameters.docs block is duplicated across many stories in this PR. A shared helper (e.g., createReadmeDocs(readme)) would reduce drift and make future docs-page changes one-line updates.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/blocks/payments-history/src/frontend/PaymentsHistory.client.stories.tsx`
around lines 13 - 25, Extract the duplicated Storybook docs config (the
parameters.docs block that renders Title/Markdown and sets description.component
to readme) into a reusable helper (e.g., createReadmeDocs(readme)) and replace
the inline block in PaymentsHistory.client.stories.tsx (and other stories) with
parameters: { docs: createReadmeDocs(readme) }; implement createReadmeDocs to
return the same shape used currently (page rendering Title/Markdown and
description.component) so all stories import and reuse it, reducing duplication
and making future doc changes one-line updates.
packages/blocks/pricing-section/src/frontend/PricingSection.client.stories.tsx (1)

13-25: Consider extracting shared README docs config to avoid drift.

This parameters.docs block is duplicated across many stories in this PR; a small shared helper would make future updates safer.

♻️ Example refactor
+import { withReadmeDocs } from '../../../.storybook/withReadmeDocs';
 import readme from '../../README.md?raw';

 const meta = {
   title: 'Blocks/PricingSection',
   component: PricingSectionPure,
   tags: ['autodocs'],
-  parameters: {
-      docs: {
-          page: () => (
-              <>
-                  <Title />
-                  <Markdown>{readme}</Markdown>
-              </>
-          ),
-          description: {
-              component: readme,
-          },
-      },
-  },
+  parameters: withReadmeDocs(readme),
 } satisfies Meta<typeof PricingSectionPure>;
// .storybook/withReadmeDocs.tsx
import React from 'react';
import { Markdown, Title } from '@storybook/addon-docs/blocks';

export const withReadmeDocs = (readme: string) => ({
  docs: {
    page: () => (
      <>
        <Title />
        <Markdown>{readme}</Markdown>
      </>
    ),
    description: { component: readme },
  },
});
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/blocks/pricing-section/src/frontend/PricingSection.client.stories.tsx`
around lines 13 - 25, The duplicated parameters.docs block (using Title,
Markdown and readme) should be extracted into a shared helper (e.g.,
withReadmeDocs) and imported into story files like
PricingSection.client.stories.tsx; create a .storybook/withReadmeDocs.tsx that
exports a function taking readme and returning the docs object, then replace the
inline parameters.docs in this file (and other stories) with parameters:
withReadmeDocs(readme) to centralize the README docs config and avoid drift.
packages/blocks/article/src/frontend/Article.client.stories.tsx (1)

32-116: Consider moving this large mock payload into a fixture module.

The inline args are very large; extracting them (e.g., articleStoryArgs) would keep the story file easier to scan and maintain.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/blocks/article/src/frontend/Article.client.stories.tsx` around lines
32 - 116, The Default story currently embeds a very large mock payload directly
in Default.args; extract that object into a separate fixture (e.g., export const
articleStoryArgs) in a new module (e.g., article.fixtures.ts) and replace the
inline object by importing and assigning articleStoryArgs to Default.args;
update any referenced fields (slug, locale, routing) as part of the exported
fixture and ensure the story file imports articleStoryArgs and uses it in the
Default constant (reference symbols: Default, Default.args, articleStoryArgs).
packages/blocks/user-account/src/frontend/UserAccount.client.stories.tsx (1)

12-25: Consider centralizing the repeated README docs config.

This parameters.docs block is duplicated across many story files in this PR. Extracting a shared helper will reduce drift and future maintenance cost.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/blocks/user-account/src/frontend/UserAccount.client.stories.tsx`
around lines 12 - 25, Extract the repeated docs JSX and settings into a shared
helper (e.g., export a createReadmeDocs(readme) function or README_DOCS
constant) that returns the parameters.docs object used by stories; then in
UserAccount.client.stories.tsx replace the inline parameters.docs block with an
import of that helper and assign parameters: { ...existingParameters, docs:
createReadmeDocs(readme) } (or parameters = { ...README_DOCS }), keeping Title,
Markdown and readme usage inside the shared helper so all stories can import and
reuse the same configuration.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@packages/blocks/ticket-summary/src/frontend/TicketSummary.client.stories.tsx`:
- Around line 71-73: The accessToken string in the story args is a malformed JWT
(payload base64 contains `fSWiaWF0` -> `}"iat` missing a comma) causing invalid
JSON; update the payload segment to match the correct encoding used in other
stories (replace the uppercase typo with the correct lowercase sequence, e.g.,
make it consistent with `fSwiaWF0`) so the payload decodes to `},"iat`, then
re-sign/regenerate the JWT signature and replace accessToken in the
TicketSummary.story args (look for the accessToken property in
TicketSummary.client.stories.tsx) with the newly signed token.

---

Nitpick comments:
In `@packages/blocks/article/src/frontend/Article.client.stories.tsx`:
- Around line 32-116: The Default story currently embeds a very large mock
payload directly in Default.args; extract that object into a separate fixture
(e.g., export const articleStoryArgs) in a new module (e.g.,
article.fixtures.ts) and replace the inline object by importing and assigning
articleStoryArgs to Default.args; update any referenced fields (slug, locale,
routing) as part of the exported fixture and ensure the story file imports
articleStoryArgs and uses it in the Default constant (reference symbols:
Default, Default.args, articleStoryArgs).

In
`@packages/blocks/payments-history/src/frontend/PaymentsHistory.client.stories.tsx`:
- Around line 13-25: Extract the duplicated Storybook docs config (the
parameters.docs block that renders Title/Markdown and sets description.component
to readme) into a reusable helper (e.g., createReadmeDocs(readme)) and replace
the inline block in PaymentsHistory.client.stories.tsx (and other stories) with
parameters: { docs: createReadmeDocs(readme) }; implement createReadmeDocs to
return the same shape used currently (page rendering Title/Markdown and
description.component) so all stories import and reuse it, reducing duplication
and making future doc changes one-line updates.

In
`@packages/blocks/pricing-section/src/frontend/PricingSection.client.stories.tsx`:
- Around line 13-25: The duplicated parameters.docs block (using Title, Markdown
and readme) should be extracted into a shared helper (e.g., withReadmeDocs) and
imported into story files like PricingSection.client.stories.tsx; create a
.storybook/withReadmeDocs.tsx that exports a function taking readme and
returning the docs object, then replace the inline parameters.docs in this file
(and other stories) with parameters: withReadmeDocs(readme) to centralize the
README docs config and avoid drift.

In `@packages/blocks/user-account/src/frontend/UserAccount.client.stories.tsx`:
- Around line 12-25: Extract the repeated docs JSX and settings into a shared
helper (e.g., export a createReadmeDocs(readme) function or README_DOCS
constant) that returns the parameters.docs object used by stories; then in
UserAccount.client.stories.tsx replace the inline parameters.docs block with an
import of that helper and assign parameters: { ...existingParameters, docs:
createReadmeDocs(readme) } (or parameters = { ...README_DOCS }), keeping Title,
Markdown and readme usage inside the shared helper so all stories can import and
reuse the same configuration.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b234a1f and 7943b05.

📒 Files selected for processing (39)
  • .changeset/rare-paths-leave.md
  • package.json
  • packages/blocks/article-list/src/frontend/ArticleList.client.stories.tsx
  • packages/blocks/article-search/src/frontend/ArticleSearch.client.stories.tsx
  • packages/blocks/article/src/frontend/Article.client.stories.tsx
  • packages/blocks/bento-grid/src/frontend/BentoGrid.client.stories.tsx
  • packages/blocks/category-list/src/frontend/CategoryList.client.stories.tsx
  • packages/blocks/category/src/frontend/Category.client.stories.tsx
  • packages/blocks/cta-section/src/frontend/CtaSection.client.stories.tsx
  • packages/blocks/document-list/src/frontend/DocumentList.client.stories.tsx
  • packages/blocks/faq/src/frontend/Faq.client.stories.tsx
  • packages/blocks/feature-section-grid/src/frontend/FeatureSectionGrid.client.stories.tsx
  • packages/blocks/feature-section/src/frontend/FeatureSection.client.stories.tsx
  • packages/blocks/featured-service-list/src/frontend/FeaturedServiceList.client.stories.tsx
  • packages/blocks/hero-section/src/frontend/HeroSection.client.stories.tsx
  • packages/blocks/invoice-list/src/frontend/InvoiceList.client.stories.tsx
  • packages/blocks/media-section/src/frontend/MediaSection.client.stories.tsx
  • packages/blocks/notification-details/src/frontend/NotificationDetails.client.stories.tsx
  • packages/blocks/notification-list/src/frontend/NotificationList.client.stories.tsx
  • packages/blocks/notification-summary/src/frontend/NotificationSummary.client.stories.tsx
  • packages/blocks/order-details/src/frontend/OrderDetails.client.stories.tsx
  • packages/blocks/order-list/src/frontend/OrderList.client.stories.tsx
  • packages/blocks/orders-summary/src/frontend/OrdersSummary.client.stories.tsx
  • packages/blocks/payments-history/src/frontend/PaymentsHistory.client.stories.tsx
  • packages/blocks/payments-summary/src/frontend/PaymentsSummary.client.stories.tsx
  • packages/blocks/pricing-section/src/frontend/PricingSection.client.stories.tsx
  • packages/blocks/product-details/src/frontend/ProductDetails.client.stories.tsx
  • packages/blocks/product-list/src/frontend/ProductList.client.stories.tsx
  • packages/blocks/quick-links/src/frontend/QuickLinks.client.stories.tsx
  • packages/blocks/recommended-products/src/frontend/RecommendedProducts.client.stories.tsx
  • packages/blocks/service-details/src/frontend/ServiceDetails.client.stories.tsx
  • packages/blocks/service-list/src/frontend/ServiceList.client.stories.tsx
  • packages/blocks/surveyjs-form/src/frontend/SurveyJs.client.stories.tsx
  • packages/blocks/ticket-details/src/frontend/TicketDetails.client.stories.tsx
  • packages/blocks/ticket-list/src/frontend/TicketList.client.stories.tsx
  • packages/blocks/ticket-recent/src/frontend/TicketRecent.client.stories.tsx
  • packages/blocks/ticket-summary/src/frontend/TicketSummary.client.stories.tsx
  • packages/blocks/user-account/src/frontend/UserAccount.client.stories.tsx
  • packages/configs/typescript-config/frontend.json

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 26, 2026

Coverage Report for packages/configs/vitest-config

Status Category Percentage Covered / Total
🔵 Lines 80.87% 1192 / 1474
🔵 Statements 80.34% 1267 / 1577
🔵 Functions 78.66% 446 / 567
🔵 Branches 72.13% 1017 / 1410
File CoverageNo changed files found.
Generated in workflow #394 for commit b506bdc by the Vitest Coverage Report Action

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 26, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
o2s-docs Skipped Skipped Feb 26, 2026 1:26pm

Request Review

@vercel vercel Bot temporarily deployed to Preview – o2s-docs February 26, 2026 13:26 Inactive
@tomaszpacior tomaszpacior merged commit fcf14d2 into main Feb 26, 2026
15 checks passed
@tomaszpacior tomaszpacior deleted the feature/add-readme-to-blocks-to-storybook branch February 26, 2026 13:44
@coderabbitai coderabbitai Bot mentioned this pull request Mar 9, 2026
1 task
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