storybookjs / addon-svelte-csf

[Incubation] CSF using Svelte components.
MIT License
103 stars 32 forks source link

v5: Fix tags being ignored #206

Closed JReinhold closed 1 month ago

JReinhold commented 1 month ago

Fixes https://github.com/storybookjs/addon-svelte-csf/issues/200

We can't and shouldn't "precombine" tags in the indexer, we should just pass them in, making sure they are in the right order. Storybook will internally combine the tags correctly, with the project-level tags.

Consider the following example:

If the indexer combines the meta and story tags with combineTags(), they'll end up as ['test', 'autodocs'] ('!dev' will be omitted completely, because it's not enabled). Then this gets passed to Storybook, which combines them with project-level tags, resulting in ['dev', 'test', 'autodocs']. This is wrong, 'dev' should not be there as it was disabled at the meta-level, but Storybook doesn't know that because the indexer already omitted '!dev'.

If we instead don't combine anything and let Storybook do it with the project level tags, it will get the following series:

['dev', 'test', '!dev', '!test', '!autodocs', 'test', 'autodocs']. Parsing these sequentially will yield the correct result: ['test', 'autodocs']

📦 Published PR as canary version: 4.1.7--canary.206.e4feeae.0
:sparkles: Test out this PR locally via: ```bash npm install @storybook/addon-svelte-csf@4.1.7--canary.206.e4feeae.0 # or yarn add @storybook/addon-svelte-csf@4.1.7--canary.206.e4feeae.0 ```

Version

Published prerelease version: v5.0.0-next.3

Changelog #### 💥 Breaking Change - Fix missing `@storybook/docs-tools` dependency [#190](https://github.com/storybookjs/addon-svelte-csf/pull/190) ([@JReinhold](https://github.com/JReinhold)) - Experimental support for Svelte 5 [#181](https://github.com/storybookjs/addon-svelte-csf/pull/181) ([@tsar-boomba](https://github.com/tsar-boomba) [@xeho91](https://github.com/xeho91) [@JReinhold](https://github.com/JReinhold) [@benoitf](https://github.com/benoitf)) #### 🐛 Bug Fix - v5: Fix tags being ignored [#206](https://github.com/storybookjs/addon-svelte-csf/pull/206) ([@JReinhold](https://github.com/JReinhold)) - fix(parser): Resolve `autodocs` tag issue and extracting `rawCode` [#201](https://github.com/storybookjs/addon-svelte-csf/pull/201) ([@xeho91](https://github.com/xeho91)) - chore: use dist folder to load the files [#185](https://github.com/storybookjs/addon-svelte-csf/pull/185) ([@benoitf](https://github.com/benoitf)) #### Authors: 4 - Florent BENOIT ([@benoitf](https://github.com/benoitf)) - Isaiah Gamble ([@tsar-boomba](https://github.com/tsar-boomba)) - Jeppe Reinhold ([@JReinhold](https://github.com/JReinhold)) - Mateusz Kadlubowski ([@xeho91](https://github.com/xeho91))
shilman commented 1 month ago

:rocket: PR was released in v5.0.0-next.3 :rocket: