diff --git a/code/lib/create-storybook/package.json b/code/lib/create-storybook/package.json index 5c75a13dfcb..7ce54a3ea37 100644 --- a/code/lib/create-storybook/package.json +++ b/code/lib/create-storybook/package.json @@ -19,23 +19,12 @@ "author": "Storybook Team", "type": "module", "exports": { - ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js" - }, + ".": "./dist/index.js", "./bin/index.cjs": "./bin/index.cjs", "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", - "types": "dist/index.d.ts", - "typesVersions": { - "*": { - "*": [ - "./dist/index.d.ts" - ] - } - }, "bin": "./bin/index.cjs", "files": [ "bin/**/*", @@ -86,7 +75,8 @@ ], "formats": [ "node-esm" - ] + ], + "types": false }, "gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae16" } diff --git a/code/lib/create-storybook/src/initiate.ts b/code/lib/create-storybook/src/initiate.ts index 3dd1a0b2d6d..ab3600a90db 100644 --- a/code/lib/create-storybook/src/initiate.ts +++ b/code/lib/create-storybook/src/initiate.ts @@ -61,7 +61,7 @@ const installStorybook = async ( skipInstall: options.skipInstall, }; - const language = await detectLanguage(packageManager); + const language = await detectLanguage(packageManager as any); const pnp = await detectPnp(); const generatorOptions: GeneratorOptions = { @@ -341,7 +341,7 @@ export async function doInitiate(options: CommandOptions): Promise< } } else { try { - projectType = (await detect(packageManager, options)) as ProjectType; + projectType = (await detect(packageManager as any, options)) as ProjectType; } catch (err) { done(String(err)); throw new HandledError(err); diff --git a/scripts/prepare/bundle.ts b/scripts/prepare/bundle.ts index 19eb324f1a8..4d090f9af9d 100755 --- a/scripts/prepare/bundle.ts +++ b/scripts/prepare/bundle.ts @@ -26,6 +26,7 @@ type BundlerConfig = { pre: string; post: string; formats: Formats[]; + types?: boolean; }; type PackageJsonWithBundlerConfig = PackageJson & { bundler: BundlerConfig; @@ -49,6 +50,7 @@ const run = async ({ cwd, flags }: { cwd: string; flags: string[] }) => { pre, post, formats = ['esm', 'cjs'], + types = true, }, } = (await fs.readJson(join(cwd, 'package.json'))) as PackageJsonWithBundlerConfig; @@ -89,6 +91,7 @@ const run = async ({ cwd, flags }: { cwd: string; flags: string[] }) => { formats, entries, optimized, + types, }); /* preset files are always CJS only. @@ -245,15 +248,17 @@ async function getDTSConfigs({ formats, entries, optimized, + types, }: { formats: Formats[]; entries: string[]; optimized: boolean; + types: boolean; }) { const tsConfigPath = join(cwd, 'tsconfig.json'); const tsConfigExists = await fs.pathExists(tsConfigPath); - const dtsBuild = optimized && formats[0] && tsConfigExists ? formats[0] : undefined; + const dtsBuild = types && optimized && formats[0] && tsConfigExists ? formats[0] : undefined; const dtsConfig: DtsConfigSection = { tsconfig: tsConfigPath,