nuxt-modules / storybook

Storybook integration with Nuxt.
https://storybook.nuxtjs.org
378 stars 82 forks source link

feat: add enabled option #612

Closed huang-julien closed 3 weeks ago

huang-julien commented 1 month ago

Fixes #555 and fixes https://github.com/storybook-vue/storybook-nuxt/issues/63.

Hi :wave: this PR adds an enabled option.

This can be useful for layers. Some users have project A, B with A extending B that has storybook but is not needed in A. This can improve dev server startup as storybook can be quite heavy to load on bigger projects.

netlify[bot] commented 1 month ago

Deploy request for nuxt-storybook pending review.

Visit the deploys page to approve it

Name Link
Latest commit be1bb487ac1afcb5f9ba6252de132e1833f93017
tobiasdiez commented 1 month ago

Good idea, this would also resolve https://github.com/nuxt-modules/storybook/issues/555, right?

I'm not so sure about the name of the option. Currently, the module indeed only starts the storybook server - but that may change in the future. So I would prefer a name that reflects that only the storybook dev server can be disabled by this option. Tailwind has it under viewer. Maybe just also use viewer here for storybook? Or do you have better suggestion?

huang-julien commented 4 weeks ago

oh indeed. About the name, i'm not convinced that viewer is a good name. This option just prevent the whole module from being run. viewer would fit an option that control if the module adds the storybook tab or not in the devtools. I don't really have any other suggestion, but i think some other modules are also using enabled

tobiasdiez commented 4 weeks ago

Okay, if more fine-grained control is needed in the future, we can add another viewer/devserver/whatever option in the future.

Could you please add a short description of the option to https://github.com/nuxt-modules/storybook/blob/main/docs/content/1.getting-started/2.options.md (perhaps with your use case of layers as motivation). Otherwise this looks good from my side.

tobiasdiez commented 3 weeks ago

Thanks!