diff --git a/code/lib/cli/src/generators/configure.test.ts b/code/lib/cli/src/generators/configure.test.ts index c65710124faf..098eedc5c937 100644 --- a/code/lib/cli/src/generators/configure.test.ts +++ b/code/lib/cli/src/generators/configure.test.ts @@ -29,7 +29,7 @@ describe('configureMain', () => { expect(mainConfigContent).toMatchInlineSnapshot(` "/** @type { import('@storybook/react-vite').StorybookConfig } */ const config = { - stories: ['../stories/**/*.mdx', '../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)'], + stories: ['../stories/**/*.mdx', '../stories/**/*.stories.@(js|jsx|mjs)'], addons: [], framework: { name: '@storybook/react-vite', @@ -95,7 +95,7 @@ describe('configureMain', () => { /** @type { import('@storybook/react-webpack5').StorybookConfig } */ const config = { - stories: ['../stories/**/*.mdx', '../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)'], + stories: ['../stories/**/*.mdx', '../stories/**/*.stories.@(js|jsx|mjs)'], addons: [ path.dirname(require.resolve(path.join('@storybook/addon-links', 'package.json'))), path.dirname(require.resolve(path.join('@storybook/addon-essentials', 'package.json'))), diff --git a/code/lib/cli/src/generators/configure.ts b/code/lib/cli/src/generators/configure.ts index 2d0a3e1f5fc8..6f3be2a351a8 100644 --- a/code/lib/cli/src/generators/configure.ts +++ b/code/lib/cli/src/generators/configure.ts @@ -49,6 +49,8 @@ const sanitizeFramework = (framework: string) => { return matches[0]; }; +const typescriptExtensions = ['ts', 'tsx', 'mts', 'cts']; + export async function configureMain({ addons, extensions = ['js', 'jsx', 'mjs', 'ts', 'tsx'], @@ -57,10 +59,14 @@ export async function configureMain({ prefixes = [], ...custom }: ConfigureMainOptions) { + const isLanguageJavascript = language === SupportedLanguage.JAVASCRIPT; + const filteredExtensions = extensions.filter((extension) => + isLanguageJavascript ? !typescriptExtensions.includes(extension) : true + ); const srcPath = path.resolve(storybookConfigFolder, '../src'); const prefix = (await fse.pathExists(srcPath)) ? '../src' : '../stories'; const config = { - stories: [`${prefix}/**/*.mdx`, `${prefix}/**/*.stories.@(${extensions.join('|')})`], + stories: [`${prefix}/**/*.mdx`, `${prefix}/**/*.stories.@(${filteredExtensions.join('|')})`], addons, ...custom, }; diff --git a/scripts/run-registry.ts b/scripts/run-registry.ts index 71ae3dd334de..8393dc4f7416 100755 --- a/scripts/run-registry.ts +++ b/scripts/run-registry.ts @@ -92,7 +92,7 @@ const publish = async (packages: { name: string; location: string }[], url: stri const command = `cd ${path.resolve( '../code', location - )} && yarn pack --out=${PACKS_DIRECTORY}/${tarballFilename} && cd ${PACKS_DIRECTORY} && npm publish ./${tarballFilename} --registry ${url} --force --access restricted --ignore-scripts`; + )} && yarn pack --out=${PACKS_DIRECTORY}/${tarballFilename} && cd ${PACKS_DIRECTORY} && npm publish ./${tarballFilename} --registry ${url} --force --ignore-scripts`; exec(command, (e) => { if (e) { rej(e);