-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: add story indexer to support storyStoreV7 #38
Conversation
Todo: fix story id generation. It currently fails with
|
As for the ID, I'm not sure I think the As with And finally I'm not sure it's a good idea to use the full file path to generate the IDs for multiple reasons:
You might get away with just using the filename instead (higher risk of collisions), or a path relative to the project root (I'm unsure how you would generate that though). I believe Storybook core combines the meta title with the story name for an ID, which might be the safest option. |
Codecov Report
@@ Coverage Diff @@
## main #38 +/- ##
==========================================
- Coverage 98.52% 96.42% -2.10%
==========================================
Files 1 3 +2
Lines 203 280 +77
Branches 36 45 +9
==========================================
+ Hits 200 270 +70
- Misses 3 10 +7
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Thanks for the input. I've now went with the meta tile + story name combination, and this seems to work well. Only problem is: how do I get the automatically generated meta title if no explicit one is specified? If I understand the code correctly, then the svelte indexer falls back to the story id/name in this case, but this seems prone to run into problems (imagine having to story files exporting a story with the name and no meta title). It feels like this area would generally profit from a bit of restructuring and putting more responsibility onto the story index generator in the upstream storybook repo. I would say the language-specific story indexer should only care about extracting the id as specified (in whatever form) by the user, and maybe adding sensible fallsbacks (like the name). Then combining these file specific ids to globally unique ones, and adding prefixes like the story meta title should happen in a consistent way an abstraction level higher. This would also make it possible to prevent id conflicts across different story file formats. |
Sounds like you're referring to the built-in autotitle feature. It's a bit hairy to reproduce, and you'd need the
I think you're right in most of this. This external indexers support is very much conceptually a v0.1 and could use a lot of API changes like these for an eventual v1 at some point. This is good feedback. |
Since replicating the auto-name feature seems a bit overkill at the moment, I'll merge this now as it is and wait for further improvements of the upstream api! Thanks for your help! |
Fixes #30.