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

Migrate to new story indexer API #147

Closed
JReinhold opened this issue Oct 23, 2023 · 3 comments · Fixed by #153
Closed

Migrate to new story indexer API #147

JReinhold opened this issue Oct 23, 2023 · 3 comments · Fixed by #153
Labels
enhancement New feature or request internal Changes only affect the internal API released This issue/pull request has been released.

Comments

@JReinhold
Copy link
Collaborator

JReinhold commented Oct 23, 2023

We've been working on a new story indexer API for some time, that is more official and public and actually documented. The API currently used by this addon was "internal" and undocumented. It has officially been deprecated in Storybook 7.5.0 in favor of the new API.

The new API is documented here: https://storybook.js.org/docs/svelte/api/main-config-indexers

I suggest we migrate this addon to the new API for multiple reasons:

  1. Remove the deprecation warning for users on Storybook >7.5.0
  2. Be ready for Storybook 8.
  3. Provide feedback to the API. We might uncover different usage patterns here that would warrant a change in the API.

The new API is not very different from the old one so migrating should hopefully be straight forward. The biggest difference is that an indexer now doesn't return an instance of CSFFile (in this case { meta: ..., stories: ...}) but rather a list of more detailed IndexInput, allowing the indexer to specify some properties that was not exposed before.
The documentation also details how transpiling CSF files is necessary etc. but that should already have been taken care of in this addon as that remains the same.

The deprecation warning is implemented in way that allows addons to support both the new and old API simultaneously if they want to. Storybook 7.4.0+ will use the experimental_indexers if found and fallback to storyIndexers with a warning. Older versions will use storyIndexers with no warnings.

The plan is to completely remove support for the old API in Storybook 8.0.

This API is behind an experimental flag right now until we feel like the API is stable It's not because it could potentially be removed since Storybook Core uses it for all story indexing internally.

@JReinhold JReinhold added enhancement New feature or request internal Changes only affect the internal API labels Oct 23, 2023
@shilman
Copy link
Member

shilman commented Nov 9, 2023

🚀 Issue was released in v4.0.10 🚀

@shilman shilman added the released This issue/pull request has been released. label Nov 9, 2023
@shilman
Copy link
Member

shilman commented Nov 9, 2023

🚀 Issue was released in v4.0.10 🚀

1 similar comment
@shilman
Copy link
Member

shilman commented Nov 9, 2023

🚀 Issue was released in v4.0.10 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request internal Changes only affect the internal API released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants