Skip to content

Commit

Permalink
feat(cli): Notices for vite storybook command (#10747)
Browse files Browse the repository at this point in the history
This adds notices to inform users to try out the vite based storybook
command.
  • Loading branch information
Josh-Walker-GM committed Jun 7, 2024
1 parent fbb4f9e commit 9faa582
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export async function handler({
port,
smokeTest,
}: StorybookYargsOptions) {
console.log(
c.bold(
`\nPlease find documentation and links to provide feedback for this new command at:\n -> https://community.redwoodjs.com/t/7212\n\n`,
),
)

// We add a stub file to type generation because users don't have Storybook
// installed when they first start a project. We need to remove the file once
// they install Storybook so that the real types come through.
Expand Down
12 changes: 11 additions & 1 deletion packages/cli-packages/storybook/src/commands/storybookHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path from 'node:path'
import type { ExecaError } from 'execa'
import execa from 'execa'

import { getPaths } from '@redwoodjs/project-config'
import { BundlerEnum, getConfig, getPaths } from '@redwoodjs/project-config'
// Allow import of untyped package
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Expand All @@ -21,6 +21,16 @@ export async function handler({
port,
smokeTest,
}: StorybookYargsOptions) {
// Notice to vite users to try `yarn rw storybook-vite`. This will eventually be the default
// once we have removed webpack. Until then we give a small nudge to vite users to try it out.
if (getConfig().web.bundler === BundlerEnum.VITE) {
console.log(
c.bold(
`\nIt looks like you're using vite, please try:\n\n yarn rw storybook-vite\n\nThis will run storybook using vite which should be a much nicer experience for you.\nYou can find out more at: https://community.redwoodjs.com/t/7212\n\n`,
),
)
}

// We add a stub file to type generation because users don't have Storybook
// installed when they first start a project. We need to remove the file once
// they install Storybook so that the real types come through.
Expand Down

0 comments on commit 9faa582

Please sign in to comment.