@@ -40,7 +40,7 @@ export const essentialsAddons = [
4040
4141export const create : Task [ 'run' ] = async (
4242 { key, template, sandboxDir } ,
43- { addon : addons , fromLocalRepro, dryRun, debug }
43+ { addon : addons , fromLocalRepro, dryRun, debug, skipTemplateStories }
4444) => {
4545 const parentDir = resolve ( sandboxDir , '..' ) ;
4646 await ensureDir ( parentDir ) ;
@@ -70,9 +70,11 @@ export const create: Task['run'] = async (
7070 }
7171
7272 const cwd = sandboxDir ;
73- for ( const addon of addons ) {
74- const addonName = `@storybook/addon-${ addon } ` ;
75- await executeCLIStep ( steps . add , { argument : addonName , cwd, dryRun, debug } ) ;
73+ if ( ! skipTemplateStories ) {
74+ for ( const addon of addons ) {
75+ const addonName = `@storybook/addon-${ addon } ` ;
76+ await executeCLIStep ( steps . add , { argument : addonName , cwd, dryRun, debug } ) ;
77+ }
7678 }
7779
7880 const mainConfig = await readMainConfig ( { cwd } ) ;
@@ -231,8 +233,6 @@ function setSandboxViteFinal(mainConfig: ConfigFile) {
231233 ) ;
232234}
233235
234-
235-
236236// Update the stories field to ensure that no TS files
237237// that are linked from the renderer are picked up in non-TS projects
238238function updateStoriesField ( mainConfig : ConfigFile , isJs : boolean ) {
@@ -244,7 +244,6 @@ function updateStoriesField(mainConfig: ConfigFile, isJs: boolean) {
244244 ? stories . map ( ( specifier ) => specifier . replace ( 'js|jsx|ts|tsx' , 'js|jsx' ) )
245245 : stories ;
246246
247-
248247 mainConfig . setFieldValue ( [ 'stories' ] , [ ...updatedStories ] ) ;
249248}
250249
@@ -257,7 +256,7 @@ function addStoriesEntry(mainConfig: ConfigFile, path: string) {
257256 titlePrefix : path ,
258257 files : '**/*.@(mdx|stories.@(js|jsx|ts|tsx))' ,
259258 } ;
260-
259+
261260 mainConfig . setFieldValue ( [ 'stories' ] , [ ...stories , entry ] ) ;
262261}
263262
@@ -278,7 +277,7 @@ async function linkPackageStories(
278277 : resolve ( cwd , 'template-stories' , packageDir ) ;
279278 await ensureSymlink ( source , target ) ;
280279
281- if ( ! linkInDir ) addStoriesEntry ( mainConfig , packageDir )
280+ if ( ! linkInDir ) addStoriesEntry ( mainConfig , packageDir ) ;
282281
283282 // Add `previewAnnotation` entries of the form
284283 // './template-stories/lib/store/preview.[tj]s'
@@ -320,7 +319,6 @@ function addExtraDependencies({
320319 }
321320}
322321
323-
324322export const addStories : Task [ 'run' ] = async (
325323 { sandboxDir, template } ,
326324 { addon : extraAddons , dryRun, debug }
@@ -332,11 +330,7 @@ export const addStories: Task['run'] = async (
332330
333331 // Ensure that we match the right stories in the stories directory
334332 const packageJson = await import ( join ( cwd , 'package.json' ) ) ;
335- updateStoriesField (
336- mainConfig ,
337- detectLanguage ( packageJson ) === SupportedLanguage . JAVASCRIPT
338- ) ;
339-
333+ updateStoriesField ( mainConfig , detectLanguage ( packageJson ) === SupportedLanguage . JAVASCRIPT ) ;
340334
341335 // Link in the template/components/index.js from store, the renderer and the addons
342336 const rendererPath = await workspacePath ( 'renderer' , template . expected . renderer ) ;
@@ -345,7 +339,7 @@ export const addStories: Task['run'] = async (
345339 resolve ( cwd , storiesPath , 'components' )
346340 ) ;
347341 addPreviewAnnotations ( mainConfig , [ `.${ sep } ${ join ( storiesPath , 'components' ) } ` ] ) ;
348-
342+
349343 // Add stories for the renderer. NOTE: these *do* need to be processed by the framework build system
350344 await linkPackageStories ( rendererPath , {
351345 mainConfig,
0 commit comments