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

Vitest addon: sb add postinstall hook (auto configuring the Vitest plugin) #28807

Closed
Tracked by #28388
yannbf opened this issue Aug 5, 2024 · 0 comments · Fixed by #28920
Closed
Tracked by #28388

Vitest addon: sb add postinstall hook (auto configuring the Vitest plugin) #28807

yannbf opened this issue Aug 5, 2024 · 0 comments · Fixed by #28920
Assignees

Comments

@yannbf
Copy link
Member

yannbf commented Aug 5, 2024

Command:

storybook add @storybook/experimental-addon-vitest

Behavior of the command:

1: Install dependency and register the addon to main.js

2.1: User does not have any vite dependency/config and is not using Nextjs

  • Bail and tell users that this use case is not supported. Point them to the docs

2.2: User does not have any vite dependency/config and is using Nextjs

2.3: User does have Vitest and not workspaces

  • Create a workspace file referring the vite/vitest.config file
  • Set up everything from steps 2.4

2.4: User does have Vite but not Vitest

  • Install vite if not present
  • Install vitest, @vitest/browser and playwright
  • run npx playwright install (chromium)
  • write storybook.setup.ts and vitest.config.ts
  • write vitest.config.ts
    • if the user has a viteFinal in main.js, warn them about using that config in the vite file
    • detect a vite config in .storybook directory first if possible
    • merge with vite.config.ts if that file exists (nextjs probably won't have it)
    • configure vite-plugin-storybook-nextjs if applicable
    • configure vue3 alias if applicable resolve: { alias: { vue: 'vue/dist/vue.esm-bundler.js', }, },

2.5: User does have Vite and Vitest

  • The CLI will provide a message telling users to read a recipe for manual installation in the docs website
@yannbf yannbf changed the title **Vitest addon:** sb add postinstall hook (auto configuring the Vitest plugin) [Kasper] Vitest addon: sb add postinstall hook (auto configuring the Vitest plugin) Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants