Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: API reference for portable stories #26081

Merged

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Feb 18, 2024

Closes #25928, #26090, #25879

What I did

This PR introduces API references for the concept of portable stories in Jest, Playwright, and Vitest

Checklist for Contributors

Testing

Manual testing

  1. Follow the steps in the contributing instructions for this branch, api-ref-portable-stories

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

馃 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

@yannbf yannbf added documentation ci:docs Run the CI jobs for documentation checks only. portable stories labels Feb 18, 2024
docs/api/portable-stories.md Outdated Show resolved Hide resolved
docs/api/portable-stories.md Outdated Show resolved Hide resolved
docs/api/portable-stories.md Outdated Show resolved Hide resolved
docs/api/portable-stories.md Outdated Show resolved Hide resolved
docs/api/portable-stories.md Outdated Show resolved Hide resolved
docs/api/portable-stories.md Outdated Show resolved Hide resolved
docs/api/portable-stories.md Outdated Show resolved Hide resolved
docs/api/portable-stories.md Outdated Show resolved Hide resolved
docs/api/portable-stories.md Outdated Show resolved Hide resolved
docs/api/portable-stories.md Outdated Show resolved Hide resolved
docs/api/portable-stories.md Outdated Show resolved Hide resolved
docs/api/portable-stories.md Outdated Show resolved Hide resolved
docs/api/story-pipeline.png Outdated Show resolved Hide resolved
docs/api/doc-block-useof.md Outdated Show resolved Hide resolved
// Replace <your-renderer> with your renderer, e.g. react, vue3
import { setProjectAnnotations } from '@storybook/<your-renderer>';
import * as addonAnnotations from 'my-addon/preview';
import * as previewAnnotations from './.storybook/preview';
Copy link
Member Author

Choose a reason for hiding this comment

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

Kinda sucks, but if users have a preview file with default export, then you'd have to do import previewAnnotations instead of import * as previewAnnotations

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually let me try to do the following:

  • support always using * as by adding a .default check inside of setProjectAnnotations
  • support Typescript types inference as well

docs/api/story-pipeline.png Outdated Show resolved Hide resolved
docs/api/portable-stories.md Outdated Show resolved Hide resolved
docs/api/portable-stories.md Outdated Show resolved Hide resolved
docs/toc.js Show resolved Hide resolved
@kylegach kylegach changed the base branch from next to feature/portable-stories-improvements February 23, 2024 18:59
@yannbf yannbf marked this pull request as ready for review February 26, 2024 14:53
kylegach and others added 11 commits February 27, 2024 11:08
Co-authored-by: Yann Braga <yannbf@gmail.com>
Co-authored-by: Yann Braga <yannbf@gmail.com>
- Organizational and prose improvements
- Remove Cypress, for now
- Improve `addonAnnotations` callout
- Fix Playwright override globals snippet
- Fix jest imports in snippets
- Replace `globalTypes` with `globals` in snippets
@storybookjs storybookjs deleted a comment from socket-security bot Feb 27, 2024
@storybookjs storybookjs deleted a comment from socket-security bot Feb 27, 2024
Copy link
Contributor

@JReinhold JReinhold left a comment

Choose a reason for hiding this comment

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

Looks good, we need few minor adjustments to the Vue API though.

Would it make sense to collapse the Jest and Vitest pages into one, to make it easier to maintain? It feels like they are very similar to each other with only minor differences, maybe even just the snippets are different? Just a suggestion, I don't have the full overview of the docs' information architecture.

@yannbf yannbf merged commit 6933131 into feature/portable-stories-improvements Mar 5, 2024
14 checks passed
@yannbf yannbf deleted the api-ref-portable-stories branch March 5, 2024 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:docs Run the CI jobs for documentation checks only. documentation portable stories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create API documentation for portable-stories
5 participants