@@ -85,7 +85,9 @@ export default class extends Generator {
8585 }
8686
8787 this . log ( "Installing Next.js..." ) ;
88- await new Promise ( ( resolve , error ) => { exec ( `npx ${ createNextAppCommand . join ( ' ' ) } && cd ${ toKebabCase ( this . options . project ) } && npm install next@14 react@18 react-dom@18` ) . on ( 'exit' , ( code ) => {
88+ const additionalPackages = 'react-tooltip' ;
89+ const patchPackages = `next@14 react@18 react-dom@18 ${ additionalPackages } ` ;
90+ await new Promise ( ( resolve , error ) => { exec ( `npx ${ createNextAppCommand . join ( ' ' ) } && cd ${ toKebabCase ( this . options . project ) } && npm install ${ patchPackages } ` ) . on ( 'exit' , ( code ) => {
8991 this . destinationRoot ( this . destinationPath ( toKebabCase ( this . options . project ) ) ) ;
9092 resolve ( ) ;
9193 } ) ; } ) ;
@@ -95,10 +97,11 @@ export default class extends Generator {
9597 // Conditionally initialize Storybook
9698 if ( this . options . storybook ) {
9799 this . log ( "Adding Storybook..." ) ;
98- this . spawnCommandSync ( 'npx' , [ '-y' , 'storybook@latest' , 'init' , '--no-dev' ] ) ;
99- if ( this . options . tailwind ) {
100- this . spawnCommandSync ( 'npx' , [ 'storybook@latest' , 'add' , '@storybook/addon-styling-webpack' ] ) ;
101- }
100+ this . spawnCommandSync ( 'npx' , [ '-y' , 'storybook@7.4' , 'init' , '--no-dev' ] ) ;
101+ // if (this.options.tailwind) {
102+ // Tailwind CSS specific setup if needed
103+ // this.spawnCommandSync('npx', ['storybook@latest', 'add', '@storybook/addon-styling-webpack']);
104+ // }
102105 }
103106 }
104107
@@ -115,14 +118,17 @@ export default class extends Generator {
115118 if ( this . options . typescript ) {
116119 this . log ( 'Replace Next.js\' TypeScript configuration file with JS...' ) ;
117120 // Remove TypeScript configuration files given they require Next.js 15
118- fs . unlinkSync ( this . destinationPath ( 'next.config.ts' ) ) ;
119- console . log ( 'Template Path:' , this . templatePath ( 'next.config.js' ) ) ;
120- console . log ( 'Destination Path:' , this . destinationPath ( 'next.config.js' ) ) ;
121+ try {
122+ fs . unlinkSync ( this . destinationPath ( 'next.config.ts' ) ) ;
123+ this . log ( `Deleted next.config.ts` ) ;
124+ } catch ( err ) {
125+ console . error ( 'Error deleting next.config.ts:' , err ) ;
126+ }
121127 this . fs . copyTpl (
122128 this . templatePath ( 'next.config.js' ) ,
123129 this . destinationPath ( 'next.config.js' ) ,
124- ) ;
125- this . log ( `Deleted next.config.ts and created next.config.js instead` ) ;
130+ ) ;
131+ this . log ( `Created next.config.js instead` ) ;
126132 }
127133 }
128134
@@ -178,6 +184,18 @@ export default class extends Generator {
178184 this . templatePath ( 'globals.css' ) ,
179185 this . destinationPath ( 'src/app/globals.css' ) ,
180186 ) ;
187+
188+ this . log ( 'Adding Bitloops support components...' ) ;
189+ this . fs . copyTpl (
190+ this . templatePath ( 'src.components.bitloops.Unsupported.tsx' ) ,
191+ this . destinationPath ( 'src/components/bitloops/Unsupported.tsx' ) ,
192+ ) ;
193+ if ( this . options . storybook ) {
194+ this . fs . copyTpl (
195+ this . templatePath ( 'src.components.bitloops.Unsupported.stories.tsx' ) ,
196+ this . destinationPath ( 'src/components/bitloops/Unsupported.stories.tsx' ) ,
197+ ) ;
198+ }
181199 }
182200 }
183201
0 commit comments