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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite: Fix storysource addon support #21096

Merged
merged 3 commits into from
Feb 15, 2023
Merged

Vite: Fix storysource addon support #21096

merged 3 commits into from
Feb 15, 2023

Conversation

shilman
Copy link
Member

@shilman shilman commented Feb 15, 2023

Closes #20421

Self-merging @tmeasday @joshwooding

What I did

This PR:

  • restores/fixes storysource support for the vite builder.
  • fixes extra addon handling in our development sandboxes

There's a bit of history behind this PR. Once upon a time, addon-docs and addon-storysource both depended on a library called source-loader to load & display raw story source.

  1. I moved addon-docs to a new library called csf-plugin here: Addon-docs: Replace source-loader with csf-plugin #19680
  2. @joshwooding added csf-plugin support for Vite and removed source-loader here: Vite: Fix static source handling for addon-docs #20147
  3. I changed the output of csf-plugin and updated addon-docs in a way that broke addon-storysource Csf-plugin: Move source to docs.source.originalSource #20665
  4. I made various fixes to source-loader/storysource to get things working in webpack, e.g. Source-loader: Fix export default variable references #20688
  5. With this change, addon-storysource and addon-docs are completely separated in both vite & webpack.

The plan is to:

  • Potentially move source handling to an "annotations server" that's part of our 7.x/8.0 roadmap
  • Create a better replacement for storysource that shares code with addon-docs
  • Deprecate storysource/source-loader, and sunset them in 8.0

How to test

  1. Run a sandbox for template, e.g. yarn task --task sandbox --start-from auto --template react-vite/default-ts --addon storysource
  2. Open Storybook in your browser
  3. Access the Button stories and view the Story tab in the addons panel

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

@shilman shilman merged commit 0e2483b into next Feb 15, 2023
@shilman shilman deleted the shilman/fix-sandbox-addons branch February 15, 2023 11:17
Copy link
Member

@joshwooding joshwooding left a comment

Choose a reason for hiding this comment

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

Nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Storysource add-on *depends* on Docs add-on to work
2 participants