@@ -170,32 +170,16 @@ export default class extends Generator {
170170 } ) [ 0 ] ;
171171
172172 if ( ! latest90 ) {
173- throw new Error ( 'No stable 9.0.x versions found.' ) ;
173+ throw new Error ( 'No stable 9.0.x versions found.' ) ;
174174 }
175175
176- // Log the chosen version (optional)
177176 this . log ( `Latest stable 9.0 version: ${ latest90 } ` ) ;
178-
179- spawnSync ( 'npx' , [
180- '-y' ,
181- `storybook@${ latest90 } ` ,
182- 'init' ,
183- '--no-dev' ,
184- '--yes' , // Skip all prompts
185- '--type' , 'nextjs' , // Specify Next.js as the framework
186- ] , { stdio : 'inherit' , cwd : this . destinationRoot ( ) } ) ;
177+ //Initializing sb with nextjs+vite
178+ spawnSync ( 'npx' , [ '-y' , 'storybook@latest' , 'init' , '--no-dev' , '--yes' , '--type' , 'nextjs' , '--builder' , 'vite' ] , { stdio : 'inherit' , cwd : this . destinationRoot ( ) } ) ;
187179 this . log ( 'Storybook installed!' ) ;
188- this . log ( 'Installing @storybook/react-vite for Vite builder support...' ) ;
189- spawnSync ( 'npm' , [
190- 'install' ,
191- '--save-dev' ,
192- '@storybook/react-vite'
193- ] , { stdio : 'inherit' , cwd : this . destinationRoot ( ) } ) ;
194- this . log ( '@storybook/react-vite installed!' ) ;
195- // if (this.options.tailwind && this.options.storybook) {
196- // Tailwind CSS specific setup for older versions of Storybook
197- // this.spawnCommandSync('npx', ['storybook@latest', 'add', '@storybook/addon-styling-webpack']);
198- // }
180+ //Verifies the correct nextjs-vite framework is used
181+ spawnSync ( 'npm' , [ 'install' , '--save-dev' , '@storybook/nextjs-vite@^9' ] , { stdio : 'inherit' , cwd : this . destinationRoot ( ) } ) ;
182+ this . log ( '@storybook/nextjs-vite installed!' ) ;
199183 }
200184 } ;
201185
0 commit comments