Merge remote-tracking branch 'origin/next' into valentin/nextjs-vite

This commit is contained in:
Valentin Palkovic 2024-08-06 10:45:29 +02:00
commit e70b42f9f0
217 changed files with 1017 additions and 546 deletions

View File

@ -152,6 +152,16 @@
"import": "./dist/preview/globals.js",
"require": "./dist/preview/globals.cjs"
},
"./cli": {
"types": "./dist/cli/index.d.ts",
"import": "./dist/cli/index.js",
"require": "./dist/cli/index.cjs"
},
"./cli/bin": {
"types": "./dist/cli/bin/index.d.ts",
"import": "./dist/cli/bin/index.js",
"require": "./dist/cli/bin/index.cjs"
},
"./package.json": "./package.json"
},
"main": "dist/index.cjs",
@ -239,6 +249,12 @@
],
"preview/globals": [
"./dist/preview/globals.d.ts"
],
"cli": [
"./dist/cli/index.d.ts"
],
"cli/bin": [
"./dist/cli/bin/index.d.ts"
]
}
},
@ -262,7 +278,7 @@
"express": "^4.19.2",
"process": "^0.11.10",
"recast": "^0.23.5",
"util": "^0.12.4",
"semver": "^7.6.2",
"ws": "^8.2.3"
},
"devDependencies": {
@ -280,7 +296,7 @@
"@emotion/styled": "^11.11.0",
"@emotion/use-insertion-effect-with-fallbacks": "^1.0.1",
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
"@ndelangen/fs-extra-unified": "^1.0.3",
"@ndelangen/get-tarball": "^3.0.7",
"@popperjs/core": "^2.6.0",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-scroll-area": "^1.0.5",
@ -304,10 +320,11 @@
"@types/picomatch": "^2.3.0",
"@types/prettier": "^3.0.0",
"@types/pretty-hrtime": "^1.0.0",
"@types/prompts": "^2.0.9",
"@types/qs": "^6",
"@types/react-syntax-highlighter": "11.0.5",
"@types/react-transition-group": "^4",
"@types/semver": "^7.3.4",
"@types/semver": "^7.5.8",
"@types/ws": "^8",
"@vitest/utils": "^1.3.1",
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.10",
@ -323,6 +340,7 @@
"chai": "^4.4.1",
"chalk": "^5.3.0",
"cli-table3": "^0.6.1",
"commander": "^6.2.1",
"comment-parser": "^1.4.1",
"compression": "^1.7.4",
"copy-to-clipboard": "^3.3.1",
@ -330,6 +348,7 @@
"css": "^3.0.0",
"deep-object-diff": "^1.1.0",
"dequal": "^2.0.2",
"detect-indent": "^7.0.1",
"detect-package-manager": "^3.0.2",
"detect-port": "^1.3.0",
"diff": "^5.2.0",
@ -347,12 +366,14 @@
"flush-promises": "^1.0.2",
"fs-extra": "^11.1.0",
"fuse.js": "^3.6.1",
"get-npm-tarball-url": "^2.0.3",
"glob": "^10.0.0",
"globby": "^14.0.1",
"handlebars": "^4.7.7",
"js-yaml": "^4.1.0",
"jsdoc-type-pratt-parser": "^4.0.0",
"lazy-universal-dotenv": "^4.0.0",
"leven": "^4.0.0",
"lodash": "^4.17.21",
"markdown-to-jsx": "^7.4.5",
"memoizerific": "^1.11.3",
@ -378,9 +399,9 @@
"react-transition-group": "^4.4.5",
"require-from-string": "^2.0.2",
"resolve-from": "^5.0.0",
"semver": "^7.3.7",
"slash": "^5.0.0",
"store2": "^2.14.2",
"strip-json-comments": "^5.0.1",
"telejson": "^7.2.0",
"tiny-invariant": "^1.3.1",
"tinyspy": "^2.2.0",

View File

@ -36,6 +36,8 @@ export const getEntries = (cwd: string) => {
define('src/manager/globals-module-info.ts', ['node'], true),
define('src/manager/globals.ts', ['node'], true),
define('src/preview/globals.ts', ['node'], true),
define('src/cli/index.ts', ['node'], true),
define('src/cli/bin/index.ts', ['node'], true),
];
};

View File

@ -2,7 +2,7 @@ import fs from 'fs';
import { join } from 'path';
import prompts from 'prompts';
import { dedent } from 'ts-dedent';
import { MissingAngularJsonError } from 'storybook/internal/server-errors';
import { MissingAngularJsonError } from '@storybook/core/server-errors';
import boxen from 'boxen';
import { logger } from '@storybook/core/node-logger';

View File

@ -0,0 +1,143 @@
import program from 'commander';
import chalk from 'chalk';
import leven from 'leven';
import { findPackageSync } from 'fd-package-json';
import invariant from 'tiny-invariant';
import { logger } from '@storybook/core/node-logger';
import { addToGlobalContext } from '@storybook/core/telemetry';
import { parseList, getEnvConfig, versions } from '@storybook/core/common';
import { dev } from '../dev';
import { build } from '../build';
addToGlobalContext('cliVersion', versions.storybook);
const pkg = findPackageSync(__dirname);
invariant(pkg, 'Failed to find the closest package.json file.');
const consoleLogger = console;
const command = (name: string) =>
program
.command(name)
.option(
'--disable-telemetry',
'Disable sending telemetry data',
// default value is false, but if the user sets STORYBOOK_DISABLE_TELEMETRY, it can be true
process.env.STORYBOOK_DISABLE_TELEMETRY && process.env.STORYBOOK_DISABLE_TELEMETRY !== 'false'
)
.option('--debug', 'Get more logs in debug mode', false)
.option('--enable-crash-reports', 'Enable sending crash reports to telemetry data');
command('dev')
.option('-p, --port <number>', 'Port to run Storybook', (str) => parseInt(str, 10))
.option('-h, --host <string>', 'Host to run Storybook')
.option('-c, --config-dir <dir-name>', 'Directory where to load Storybook configurations from')
.option(
'--https',
'Serve Storybook over HTTPS. Note: You must provide your own certificate information.'
)
.option(
'--ssl-ca <ca>',
'Provide an SSL certificate authority. (Optional with --https, required if using a self-signed certificate)',
parseList
)
.option('--ssl-cert <cert>', 'Provide an SSL certificate. (Required with --https)')
.option('--ssl-key <key>', 'Provide an SSL key. (Required with --https)')
.option('--smoke-test', 'Exit after successful start')
.option('--ci', "CI mode (skip interactive prompts, don't open browser)")
.option('--no-open', 'Do not open Storybook automatically in the browser')
.option('--loglevel <level>', 'Control level of logging during build')
.option('--quiet', 'Suppress verbose build output')
.option('--no-version-updates', 'Suppress update check', true)
.option('--debug-webpack', 'Display final webpack configurations for debugging purposes')
.option(
'--webpack-stats-json [directory]',
'Write Webpack stats JSON to disk (synonym for `--stats-json`)'
)
.option('--stats-json [directory]', 'Write stats JSON to disk')
.option(
'--preview-url <string>',
'Disables the default storybook preview and lets your use your own'
)
.option('--force-build-preview', 'Build the preview iframe even if you are using --preview-url')
.option('--docs', 'Build a documentation-only site using addon-docs')
.option('--exact-port', 'Exit early if the desired port is not available')
.option(
'--initial-path [path]',
'URL path to be appended when visiting Storybook for the first time'
)
.action(async (options) => {
logger.setLevel(program.loglevel);
consoleLogger.log(chalk.bold(`${pkg.name} v${pkg.version}`) + chalk.reset('\n'));
// The key is the field created in `options` variable for
// each command line argument. Value is the env variable.
getEnvConfig(options, {
port: 'SBCONFIG_PORT',
host: 'SBCONFIG_HOSTNAME',
staticDir: 'SBCONFIG_STATIC_DIR',
configDir: 'SBCONFIG_CONFIG_DIR',
ci: 'CI',
});
if (parseInt(`${options.port}`, 10)) {
options.port = parseInt(`${options.port}`, 10);
}
await dev({ ...options, packageJson: pkg }).catch(() => process.exit(1));
});
command('build')
.option('-o, --output-dir <dir-name>', 'Directory where to store built files')
.option('-c, --config-dir <dir-name>', 'Directory where to load Storybook configurations from')
.option('--quiet', 'Suppress verbose build output')
.option('--loglevel <level>', 'Control level of logging during build')
.option('--debug-webpack', 'Display final webpack configurations for debugging purposes')
.option(
'--webpack-stats-json [directory]',
'Write Webpack stats JSON to disk (synonym for `--stats-json`)'
)
.option('--stats-json [directory]', 'Write stats JSON to disk')
.option(
'--preview-url <string>',
'Disables the default storybook preview and lets your use your own'
)
.option('--force-build-preview', 'Build the preview iframe even if you are using --preview-url')
.option('--docs', 'Build a documentation-only site using addon-docs')
.option('--test', 'Build stories optimized for testing purposes.')
.action(async (options) => {
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
logger.setLevel(program.loglevel);
consoleLogger.log(chalk.bold(`${pkg.name} v${pkg.version}\n`));
// The key is the field created in `options` variable for
// each command line argument. Value is the env variable.
getEnvConfig(options, {
staticDir: 'SBCONFIG_STATIC_DIR',
outputDir: 'SBCONFIG_OUTPUT_DIR',
configDir: 'SBCONFIG_CONFIG_DIR',
});
await build({
...options,
packageJson: pkg,
test: !!options.test || process.env.SB_TESTBUILD === 'true',
}).catch(() => process.exit(1));
});
program.on('command:*', ([invalidCmd]) => {
consoleLogger.error(
' Invalid command: %s.\n See --help for a list of available commands.',
invalidCmd
);
// eslint-disable-next-line no-underscore-dangle
const availableCommands = program.commands.map((cmd) => cmd._name);
const suggestion = availableCommands.find((cmd) => leven(cmd, invalidCmd) < 3);
if (suggestion) {
consoleLogger.info(`\n Did you mean ${suggestion}?`);
}
process.exit(1);
});
program.usage('<command> [options]').version(String(pkg.version)).parse(process.argv);

View File

@ -1,5 +1,5 @@
import * as fs from 'fs';
import findUp from 'find-up';
import { findUpSync } from 'find-up';
import semver from 'semver';
import { logger } from '@storybook/core/node-logger';
@ -110,8 +110,8 @@ export function detectFrameworkPreset(
* @returns CoreBuilder
*/
export async function detectBuilder(packageManager: JsPackageManager, projectType: ProjectType) {
const viteConfig = findUp.sync(viteConfigFiles);
const webpackConfig = findUp.sync(webpackConfigFiles);
const viteConfig = findUpSync(viteConfigFiles);
const webpackConfig = findUpSync(webpackConfigFiles);
const dependencies = await packageManager.getAllDependencies();
if (viteConfig || (dependencies.vite && dependencies.webpack === undefined)) {
@ -161,7 +161,7 @@ export function isStorybookInstantiated(configDir = resolve(process.cwd(), '.sto
}
export async function detectPnp() {
return !!findUp.sync(['.pnp.js', '.pnp.cjs']);
return !!findUpSync(['.pnp.js', '.pnp.cjs']);
}
export async function detectLanguage(packageManager: JsPackageManager) {

View File

@ -7,16 +7,11 @@ import invariant from 'tiny-invariant';
import { externalFrameworks } from './project_types';
import type { SupportedRenderers } from './project_types';
import type { JsPackageManager } from '@storybook/core/common';
import { versions } from '@storybook/core/common';
import { temporaryDirectory, versions } from '@storybook/core/common';
import type { SupportedFrameworks } from '@storybook/core/types';
export function getCliDir() {
return dirname(require.resolve('storybook/package.json'));
}
const resolveUsingBranchInstall = async (packageManager: JsPackageManager, request: string) => {
const { temporaryDirectory } = await import('tempy');
const tempDirectory = temporaryDirectory();
const tempDirectory = await temporaryDirectory();
const name = request as keyof typeof versions;
// FIXME: this might not be the right version for community packages

View File

@ -7,6 +7,7 @@ import chalk from 'chalk';
import { readConfig, writeConfig } from '@storybook/core/csf-tools';
import type { JsPackageManager } from '@storybook/core/common';
import { paddedLog } from '@storybook/core/common';
import fs from 'node:fs';
export const SUPPORTED_ESLINT_EXTENSIONS = ['js', 'cjs', 'json'];
const UNSUPPORTED_ESLINT_EXTENSIONS = ['yaml', 'yml'];
@ -14,7 +15,7 @@ const UNSUPPORTED_ESLINT_EXTENSIONS = ['yaml', 'yml'];
export const findEslintFile = () => {
const filePrefix = '.eslintrc';
const unsupportedExtension = UNSUPPORTED_ESLINT_EXTENSIONS.find((ext: string) =>
fse.existsSync(`${filePrefix}.${ext}`)
fs.existsSync(`${filePrefix}.${ext}`)
);
if (unsupportedExtension) {
@ -22,7 +23,7 @@ export const findEslintFile = () => {
}
const extension = SUPPORTED_ESLINT_EXTENSIONS.find((ext: string) =>
fse.existsSync(`${filePrefix}.${ext}`)
fs.existsSync(`${filePrefix}.${ext}`)
);
return extension ? `${filePrefix}.${extension}` : null;
};

View File

@ -38,7 +38,6 @@ vi.mock('fs', async (importOriginal) => {
vi.mock('./dirs', () => ({
getRendererDir: (_: JsPackageManager, renderer: string) =>
normalizePath(`@storybook/${renderer}`),
getCliDir: () => normalizePath('storybook'),
}));
vi.mock('fs-extra', async (importOriginal) => {
@ -123,11 +122,12 @@ describe('Helpers', () => {
renderer: 'react',
language,
packageManager: packageManagerMock,
commonAssetsDir: normalizePath('create-storybook/rendererAssets/common'),
});
expect(fse.copy).toHaveBeenNthCalledWith(
1,
normalizePath('storybook/rendererAssets/common'),
normalizePath('create-storybook/rendererAssets/common'),
'./stories',
expect.anything()
);

View File

@ -5,9 +5,9 @@ import path, { join } from 'path';
import { coerce, satisfies } from 'semver';
import stripJsonComments from 'strip-json-comments';
import findUp from 'find-up';
import { findUpSync } from 'find-up';
import invariant from 'tiny-invariant';
import { getCliDir, getRendererDir } from './dirs';
import { getRendererDir } from './dirs';
import {
type JsPackageManager,
type PackageJson,
@ -15,8 +15,7 @@ import {
frameworkToRenderer as CoreFrameworkToRenderer,
} from '@storybook/core/common';
import type { SupportedFrameworks, SupportedRenderers } from '@storybook/core/types';
import { CoreBuilder } from './project_types';
import { SupportedLanguage } from './project_types';
import { CoreBuilder, SupportedLanguage } from './project_types';
import { versions as storybookMonorepoPackages } from '@storybook/core/common';
const logger = console;
@ -128,7 +127,7 @@ type CopyTemplateFilesOptions = {
packageManager: JsPackageManager;
renderer: SupportedFrameworks | SupportedRenderers;
language: SupportedLanguage;
includeCommonAssets?: boolean;
commonAssetsDir?: string;
destination?: string;
};
@ -165,7 +164,7 @@ export async function copyTemplateFiles({
renderer,
language,
destination,
includeCommonAssets = true,
commonAssetsDir,
}: CopyTemplateFilesOptions) {
const languageFolderMapping: Record<SupportedLanguage | 'typescript', string> = {
// keeping this for backwards compatibility in case community packages are using it
@ -214,14 +213,14 @@ export async function copyTemplateFiles({
};
const destinationPath = destination ?? (await targetPath());
if (includeCommonAssets) {
await fse.copy(join(getCliDir(), 'rendererAssets', 'common'), destinationPath, {
if (commonAssetsDir) {
await fse.copy(commonAssetsDir, destinationPath, {
overwrite: true,
});
}
await fse.copy(await templatePath(), destinationPath, { overwrite: true });
if (includeCommonAssets) {
if (commonAssetsDir) {
let rendererType = frameworkToRenderer[renderer] || 'react';
// This is only used for docs links and the docs site uses `vue` for both `vue` & `vue3` renderers
if (rendererType === 'vue3') rendererType = 'vue';
@ -261,7 +260,7 @@ export function getStorybookVersionSpecifier(packageJson: PackageJsonWithDepsAnd
}
export async function isNxProject() {
return findUp.sync('nx.json');
return findUpSync('nx.json');
}
export function coerceSemver(version: string) {

View File

@ -0,0 +1,7 @@
export * from './detect';
export * from './helpers';
export * from './angular/helpers';
export * from './dirs';
export * from './project_types';
export * from './NpmOptions';
export * from './eslintPlugin';

View File

@ -1,4 +1,4 @@
import sort from 'semver/functions/sort';
import sort from 'semver/functions/sort.js';
import { platform } from 'os';
import dedent from 'ts-dedent';
import { findUpSync } from 'find-up';

View File

@ -63,6 +63,7 @@ export default {
'@storybook/cli': '8.3.0-alpha.3',
'@storybook/codemod': '8.3.0-alpha.3',
'@storybook/core-webpack': '8.3.0-alpha.3',
'create-storybook': '8.3.0-alpha.3',
'@storybook/csf-plugin': '8.3.0-alpha.3',
'@storybook/instrumenter': '8.3.0-alpha.3',
'@storybook/react-dom-shim': '8.3.0-alpha.3',

View File

@ -2,7 +2,7 @@ import { logger } from '@storybook/core/node-logger';
import {
getIncompatibleStorybookPackages,
getIncompatiblePackagesSummary,
} from '../../../../lib/cli/src/doctor/getIncompatibleStorybookPackages';
} from '../../../../lib/cli-storybook/src/doctor/getIncompatibleStorybookPackages';
export const warnOnIncompatibleAddons = async (currentStorybookVersion: string) => {
const incompatiblePackagesList = await getIncompatibleStorybookPackages({

View File

@ -0,0 +1,36 @@
const ignore = 0;
module.exports = {
overrides: [
{
files: 'templates/**/*',
env: {
browser: true,
},
rules: {
'react/no-this-in-sfc': ignore,
'import/no-unresolved': ignore,
'react/react-in-jsx-scope': ignore,
'import/no-extraneous-dependencies': ignore,
'global-require': ignore,
'no-redeclare': ignore,
'react/prop-types': ignore,
},
},
{
files: 'rendererAssets/**/*',
env: {
browser: true,
},
rules: {
'jsx-a11y/anchor-is-valid': ignore,
'import/no-unresolved': ignore,
'react/prop-types': ignore,
'react/react-in-jsx-scope': ignore,
'import/no-extraneous-dependencies': ignore,
'import/extensions': ignore,
'import/named': ignore,
},
},
],
};

View File

@ -1,3 +1,49 @@
# Storybook CLI
# Storybook
This is a wrapper for <https://www.npmjs.com/package/@storybook/cli>
## CLI
Storybook CLI (_Command Line Interface_) is the easiest way to add [Storybook](https://github.com/storybookjs/storybook) to your project.
![Screenshot](docs/getstorybook.png)
Go to your project and run:
```sh
cd my-app
npx storybook@latest init
```
In addition to `init`, the CLI also has other commands:
- `add` - add an addon and register it
- `info` - print out system information for bug reports
- `upgrade` - upgrade to the latest version of Storybook (or a specific version)
- `migrate` - run codemods to migrate your code
See the command-line help with `-h` (including other useful commands) for details.
## Core APIs
This package has multiple sub-exports to can be used to gain access to storybook's APIs.
### `storybook/components`
This export contains a list of components very useful for building out addons.
We recommend addon-authors to use these components to ensure a consistent look and feel, and to reduce the amount of code they need to write.
### `storybook/theming`
This export exposes a few utility functions to help writing components that automatically adapt to the current theme.
Useful for addon authors who want to make their addons theme-aware.
### `storybook/preview-api`
This export contains the API that is available in the preview iframe.
### `storybook/manager-api`
This export contains the API that is available in the manager iframe.
### `storybook/types`
This export exposes a lot of TypeScript interfaces used throughout storybook, including for storybook configuration, addons etc.

View File

@ -0,0 +1,26 @@
#!/usr/bin/env node
const majorNodeVersion = parseInt(process.versions.node, 10);
if (majorNodeVersion < 18) {
console.error('To run Storybook you need to have Node.js 18 or higher');
process.exit(1);
}
// The Storybook CLI has a catch block for all of its commands, but if an error
// occurs before the command even runs, for instance, if an import fails, then
// such error will fall under the uncaughtException handler.
// This is the earliest moment we can catch such errors.
process.once('uncaughtException', (error) => {
if (error.message.includes('string-width')) {
console.error(
[
'🔴 Error: It looks like you are having a known issue with package hoisting.',
'Please check the following issue for details and solutions: https://github.com/storybookjs/storybook/issues/22431#issuecomment-1630086092\n\n',
].join('\n')
);
}
throw error;
});
require('../dist/bin/index.cjs');

View File

@ -1,3 +0,0 @@
#!/usr/bin/env node
require('storybook/bin/index.cjs');

View File

@ -19,15 +19,66 @@
"url": "https://opencollective.com/storybook"
},
"license": "MIT",
"bin": {
"sb": "./index.js",
"storybook": "./index.js"
"author": "Storybook Team",
"type": "module",
"exports": {
"./bin/index.cjs": {
"node": "./bin/index.cjs",
"require": "./bin/index.cjs"
},
"./package.json": "./package.json"
},
"bin": "./bin/index.cjs",
"files": [
"bin/**/*",
"dist/**/*",
"README.md",
"!src/**/*"
],
"scripts": {
"check": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/check.ts",
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"storybook": "workspace:*"
"@babel/core": "^7.24.4",
"@babel/types": "^7.24.0",
"@storybook/codemod": "workspace:*",
"@types/semver": "^7.3.4",
"chalk": "^4.1.0",
"commander": "^6.2.1",
"create-storybook": "workspace:*",
"cross-spawn": "^7.0.3",
"envinfo": "^7.7.3",
"fd-package-json": "^1.2.0",
"find-up": "^5.0.0",
"fs-extra": "^11.1.0",
"giget": "^1.0.0",
"globby": "^14.0.1",
"jscodeshift": "^0.15.1",
"leven": "^3.1.0",
"prompts": "^2.4.0",
"semver": "^7.3.7",
"storybook": "workspace:*",
"tiny-invariant": "^1.3.1",
"ts-dedent": "^2.0.0"
},
"devDependencies": {
"@types/cross-spawn": "^6.0.2",
"@types/prompts": "^2.0.9",
"boxen": "^7.1.1",
"slash": "^5.0.0",
"strip-ansi": "^7.1.0",
"typescript": "^5.3.2"
},
"publishConfig": {
"access": "public"
},
"bundler": {
"entries": [
"./src/index.ts",
"./src/bin/index.ts"
],
"platform": "node"
},
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae16"
}

View File

@ -2,5 +2,7 @@
"name": "cli-storybook",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"targets": {}
"targets": {
"build": {}
}
}

View File

@ -25,7 +25,7 @@ const MockedConsole = {
error: vi.fn(),
} as any as Console;
vi.mock('@storybook/core/csf-tools', () => {
vi.mock('storybook/internal/csf-tools', () => {
return {
readConfig: vi.fn(() => MockedConfig),
writeConfig: vi.fn(),
@ -34,7 +34,7 @@ vi.mock('@storybook/core/csf-tools', () => {
vi.mock('./postinstallAddon', () => {
return MockedPostInstall;
});
vi.mock('@storybook/core/common', () => {
vi.mock('storybook/internal/common', () => {
return {
getStorybookInfo: vi.fn(() => ({ mainConfig: {}, configDir: '' })),
serverRequire: vi.fn(() => ({})),

View File

@ -5,8 +5,8 @@ import {
getCoercedStorybookVersion,
type PackageManagerName,
versions,
} from '@storybook/core/common';
import { readConfig, writeConfig } from '@storybook/core/csf-tools';
} from 'storybook/internal/common';
import { readConfig, writeConfig } from 'storybook/internal/csf-tools';
import { isAbsolute, join } from 'path';
import SemVer from 'semver';
import { dedent } from 'ts-dedent';

View File

@ -1,6 +1,6 @@
import { createBlocker } from './types';
import { dedent } from 'ts-dedent';
import type { StorybookConfigRaw } from '@storybook/core/types';
import type { StorybookConfigRaw } from 'storybook/internal/types';
import chalk from 'chalk';
export const blocker = createBlocker({

View File

@ -1,8 +1,8 @@
import { expect, test, vi } from 'vitest';
import { autoblock } from './index';
import { JsPackageManagerFactory } from '@storybook/core/common';
import { JsPackageManagerFactory } from 'storybook/internal/common';
import { createBlocker } from './types';
import { logger as loggerRaw } from '@storybook/core/node-logger';
import { logger as loggerRaw } from 'storybook/internal/node-logger';
import stripAnsi from 'strip-ansi';
vi.mock('node:fs/promises', async (importOriginal) => ({
@ -12,7 +12,7 @@ vi.mock('node:fs/promises', async (importOriginal) => ({
vi.mock('boxen', () => ({
default: vi.fn((x) => x),
}));
vi.mock('@storybook/core/node-logger', () => ({
vi.mock('storybook/internal/node-logger', () => ({
logger: {
info: vi.fn(),
line: vi.fn(),

View File

@ -1,5 +1,5 @@
import type { AutoblockOptions, Blocker } from './types';
import { logger } from '@storybook/core/node-logger';
import { logger } from 'storybook/internal/node-logger';
import chalk from 'chalk';
import boxen from 'boxen';

View File

@ -1,5 +1,5 @@
import type { JsPackageManager, PackageJson } from '@storybook/core/common';
import type { StorybookConfig } from '@storybook/core/types';
import type { JsPackageManager, PackageJson } from 'storybook/internal/common';
import type { StorybookConfig } from 'storybook/internal/types';
export interface AutoblockOptions {
packageManager: JsPackageManager;

View File

@ -1,6 +1,6 @@
import { addonPostCSS } from './addon-postcss';
import type { StorybookConfig } from '@storybook/core/types';
import type { JsPackageManager } from '@storybook/core/common';
import type { StorybookConfig } from 'storybook/internal/types';
import type { JsPackageManager } from 'storybook/internal/common';
import { expect, describe, it } from 'vitest';
const checkAddonPostCSS = async ({

View File

@ -1,6 +1,6 @@
import { addonsAPI } from './addons-api';
import type { StorybookConfig } from '@storybook/core/types';
import type { JsPackageManager } from '@storybook/core/common';
import type { StorybookConfig } from 'storybook/internal/types';
import type { JsPackageManager } from 'storybook/internal/common';
import { expect, describe, it } from 'vitest';
const checkAddonsAPI = async ({

View File

@ -1,9 +1,8 @@
import { describe, beforeEach, afterEach, it, expect, vi } from 'vitest';
import type { StorybookConfig } from '@storybook/core/types';
import type { JsPackageManager } from '@storybook/core/common';
import type { StorybookConfig } from 'storybook/internal/types';
import type { JsPackageManager } from 'storybook/internal/common';
import { angularBuildersMultiproject } from './angular-builders-multiproject';
import * as helpers from '../../helpers';
import * as angularHelpers from '../../generators/ANGULAR/helpers';
import * as helpers from 'storybook/internal/cli';
const checkAngularBuilders = async ({
packageManager,
@ -19,13 +18,9 @@ const checkAngularBuilders = async ({
});
};
vi.mock('../../helpers', async (importOriginal) => ({
...(await importOriginal<typeof import('../../helpers')>()),
vi.mock('storybook/internal/cli', async (importOriginal) => ({
...(await importOriginal<typeof import('storybook/internal/cli')>()),
isNxProject: vi.fn(),
}));
vi.mock('../../generators/ANGULAR/helpers', async (importOriginal) => ({
...(await importOriginal<typeof import('../../generators/ANGULAR/helpers')>()),
AngularJSON: vi.fn(),
}));
@ -100,7 +95,7 @@ describe('is not Nx project', () => {
describe('has one Storybook builder defined', () => {
beforeEach(() => {
// Mock AngularJSON.constructor
vi.mocked(angularHelpers.AngularJSON).mockImplementation(
vi.mocked(helpers.AngularJSON).mockImplementation(
() =>
({
hasStorybookBuilder: true,
@ -121,7 +116,7 @@ describe('is not Nx project', () => {
describe('has one project', () => {
beforeEach(() => {
// Mock AngularJSON.constructor
vi.mocked(angularHelpers.AngularJSON).mockImplementation(
vi.mocked(helpers.AngularJSON).mockImplementation(
() =>
({
hasStorybookBuilder: false,
@ -146,7 +141,7 @@ describe('is not Nx project', () => {
describe('has multiple projects without root project defined', () => {
beforeEach(() => {
// Mock AngularJSON.constructor
vi.mocked(angularHelpers.AngularJSON).mockImplementation(
vi.mocked(helpers.AngularJSON).mockImplementation(
() =>
({
hasStorybookBuilder: false,

View File

@ -2,8 +2,7 @@ import { dedent } from 'ts-dedent';
import semver from 'semver';
import chalk from 'chalk';
import type { Fix } from '../types';
import { isNxProject } from '../../helpers';
import { AngularJSON } from '../../generators/ANGULAR/helpers';
import { isNxProject, AngularJSON } from 'storybook/internal/cli';
import { getFrameworkPackageName } from '../helpers/mainConfigFile';
interface AngularBuildersMultiprojectRunOptions {}

View File

@ -1,9 +1,8 @@
import { describe, beforeEach, afterEach, it, expect, vi } from 'vitest';
import type { StorybookConfig } from '@storybook/core/types';
import type { StorybookConfig } from 'storybook/internal/types';
import { angularBuilders } from './angular-builders';
import * as helpers from '../../helpers';
import * as angularHelpers from '../../generators/ANGULAR/helpers';
import type { JsPackageManager } from '@storybook/core/common';
import * as helpers from 'storybook/internal/cli';
import type { JsPackageManager } from 'storybook/internal/common';
const checkAngularBuilders = async ({
packageManager,
@ -21,13 +20,9 @@ const checkAngularBuilders = async ({
});
};
vi.mock('../../helpers', async (importOriginal) => ({
...(await importOriginal<typeof import('../../helpers')>()),
vi.mock('storybook/internal/cli', async (importOriginal) => ({
...(await importOriginal<typeof import('storybook/internal/cli')>()),
isNxProject: vi.fn(),
}));
vi.mock('../../generators/ANGULAR/helpers', async (importOriginal) => ({
...(await importOriginal<typeof import('../../generators/ANGULAR/helpers')>()),
AngularJSON: vi.fn(),
}));
@ -85,7 +80,7 @@ describe('is not Nx project', () => {
describe('has one Storybook builder defined', () => {
beforeEach(() => {
// Mock AngularJSON.constructor
vi.mocked(angularHelpers.AngularJSON).mockImplementation(
vi.mocked(helpers.AngularJSON).mockImplementation(
() =>
({
hasStorybookBuilder: true,
@ -106,7 +101,7 @@ describe('is not Nx project', () => {
describe('has multiple projects without root project defined', () => {
beforeEach(() => {
// Mock AngularJSON.constructor
vi.mocked(angularHelpers.AngularJSON).mockImplementation(
vi.mocked(helpers.AngularJSON).mockImplementation(
() =>
({
hasStorybookBuilder: false,
@ -132,7 +127,7 @@ describe('is not Nx project', () => {
describe('has one project', () => {
beforeEach(() => {
// Mock AngularJSON.constructor
vi.mocked(angularHelpers.AngularJSON).mockImplementation(
vi.mocked(helpers.AngularJSON).mockImplementation(
() =>
({
hasStorybookBuilder: false,

View File

@ -1,11 +1,10 @@
import { dedent } from 'ts-dedent';
import type { StorybookConfig } from '@storybook/core/types';
import type { StorybookConfig } from 'storybook/internal/types';
import chalk from 'chalk';
import prompts from 'prompts';
import type { Fix } from '../types';
import { isNxProject } from '../../helpers';
import { AngularJSON } from '../../generators/ANGULAR/helpers';
import type { JsPackageManager } from '@storybook/core/common';
import { isNxProject, AngularJSON } from 'storybook/internal/cli';
import type { JsPackageManager } from 'storybook/internal/common';
import { getFrameworkPackageName } from '../helpers/mainConfigFile';
interface AngularBuildersRunOptions {

View File

@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import type { StorybookConfig } from '@storybook/core/types';
import type { StorybookConfig } from 'storybook/internal/types';
import { autodocsTags } from './autodocs-tags';
const check = async ({

View File

@ -1,7 +1,7 @@
import { dedent } from 'ts-dedent';
import chalk from 'chalk';
import type { DocsOptions } from '@storybook/core/types';
import { readConfig, writeConfig } from '@storybook/core/csf-tools';
import type { DocsOptions } from 'storybook/internal/types';
import { readConfig, writeConfig } from 'storybook/internal/csf-tools';
import { updateMainConfig } from '../helpers/mainConfigFile';
import type { Fix } from '../types';

View File

@ -1,5 +1,5 @@
import { describe, afterEach, it, expect, vi } from 'vitest';
import type { StorybookConfigRaw, PackageJson } from '@storybook/core/types';
import type { StorybookConfigRaw, PackageJson } from 'storybook/internal/types';
import { makePackageManager } from '../helpers/testing-helpers';
import { autodocsTrue } from './autodocs-true';

View File

@ -1,5 +1,5 @@
import { describe, afterEach, it, expect, vi } from 'vitest';
import type { StorybookConfigRaw, PackageJson } from '@storybook/core/types';
import type { StorybookConfigRaw, PackageJson } from 'storybook/internal/types';
import { makePackageManager } from '../helpers/testing-helpers';
import { builderVite } from './builder-vite';

View File

@ -1,12 +1,12 @@
import chalk from 'chalk';
import { dedent } from 'ts-dedent';
import { writeConfig } from '@storybook/core/csf-tools';
import { writeConfig } from 'storybook/internal/csf-tools';
import type { Fix } from '../types';
import type { PackageJson } from '@storybook/core/types';
import type { PackageJson } from 'storybook/internal/types';
import { updateMainConfig } from '../helpers/mainConfigFile';
import { getStorybookVersionSpecifier } from '../../helpers';
import { getStorybookVersionSpecifier } from 'storybook/internal/cli';
const logger = console;

View File

@ -1,6 +1,6 @@
import { describe, afterEach, it, expect, vi } from 'vitest';
import type { StorybookConfigRaw } from '@storybook/core/types';
import type { JsPackageManager } from '@storybook/core/common';
import type { StorybookConfigRaw } from 'storybook/internal/types';
import type { JsPackageManager } from 'storybook/internal/common';
import { cra5 } from './cra5';
const checkCra5 = async ({

View File

@ -2,11 +2,13 @@
import { describe, it, expect, vi } from 'vitest';
import { dedent } from 'ts-dedent';
import * as fsExtra from 'fs-extra';
import type { PackageJson } from '@storybook/core/common';
import type { PackageJson } from 'storybook/internal/common';
import { eslintPlugin } from './eslint-plugin';
import { makePackageManager } from '../helpers/testing-helpers';
import * as fs from 'node:fs';
vi.mock('fs-extra', async () => import('../../../../../__mocks__/fs-extra'));
vi.mock('fs');
const checkEslint = async ({
packageJson,
@ -39,6 +41,7 @@ const checkEslint = async ({
}
`),
});
vi.mocked(fs).existsSync.mockImplementation(() => true);
return eslintPlugin.check({
packageManager: makePackageManager(packageJson),
mainConfig: {} as any,

View File

@ -6,7 +6,7 @@ import {
extractEslintInfo,
findEslintFile,
SUPPORTED_ESLINT_EXTENSIONS,
} from '../helpers/eslintPlugin';
} from 'storybook/internal/cli';
import type { Fix } from '../types';

View File

@ -2,8 +2,8 @@ import { dedent } from 'ts-dedent';
import chalk from 'chalk';
import { readFile, writeFile } from 'fs-extra';
import type { Expression } from '@babel/types';
import type { ConfigFile } from '@storybook/core/csf-tools';
import { loadConfig, formatConfig } from '@storybook/core/csf-tools';
import type { ConfigFile } from 'storybook/internal/csf-tools';
import { loadConfig, formatConfig } from 'storybook/internal/csf-tools';
import type { Fix } from '../types';
const MIGRATION =

View File

@ -1,5 +1,5 @@
import { describe, expect, vi, it } from 'vitest';
import type { StorybookConfig } from '@storybook/core/types';
import type { StorybookConfig } from 'storybook/internal/types';
import { mdxgfm } from './mdx-gfm';
vi.mock('globby', () => ({

View File

@ -1,10 +1,10 @@
import { dedent } from 'ts-dedent';
import { join } from 'path';
import slash from 'slash';
import { commonGlobOptions } from '@storybook/core/common';
import { commonGlobOptions } from 'storybook/internal/common';
import { updateMainConfig } from '../helpers/mainConfigFile';
import type { Fix } from '../types';
import { getStorybookVersionSpecifier } from '../../helpers';
import { getStorybookVersionSpecifier } from 'storybook/internal/cli';
const logger = console;

View File

@ -1,6 +1,6 @@
import { describe, afterEach, it, expect, vi } from 'vitest';
import type { StorybookConfigRaw, PackageJson } from '@storybook/core/types';
import type { StorybookConfigRaw, PackageJson } from 'storybook/internal/types';
import { ansiRegex } from '../helpers/cleanLog';
import { makePackageManager } from '../helpers/testing-helpers';
import type { BareMdxStoriesGlobRunOptions } from './mdx-to-csf';

View File

@ -1,6 +1,6 @@
import chalk from 'chalk';
import { dedent } from 'ts-dedent';
import type { StoriesEntry } from '@storybook/core/types';
import type { StoriesEntry } from 'storybook/internal/types';
import { updateMainConfig } from '../helpers/mainConfigFile';
import type { Fix } from '../types';
import { runCodemod } from '@storybook/codemod';

View File

@ -9,9 +9,11 @@ vi.mock('globby', () => ({
globby: vi.fn().mockResolvedValue(['.storybook/manager.ts', 'path/to/file.stories.tsx']),
}));
vi.mock('node:fs/promises', () => ({
__esModule: true,
readFile: vi.fn().mockResolvedValue(`
vi.mock('node:fs/promises', async (importOriginal) => {
const original = (await importOriginal()) as typeof import('node:fs/promises');
return {
...original,
readFile: vi.fn().mockResolvedValue(`
// these are NOT installed, will be reported
import { someFunction } from '@storybook/preview-api';
import { anotherFunction } from '@storybook/manager-api';
@ -19,7 +21,8 @@ vi.mock('node:fs/promises', () => ({
// this IS installed, will not be reported
import { yetAnotherFunction } from '@storybook/theming';
`),
}));
};
});
vi.mock('../../helpers', () => ({
getStorybookVersionSpecifier: vi.fn().mockReturnValue('^8.1.10'),
@ -111,12 +114,12 @@ describe('missingStorybookDependencies', () => {
expect(mockPackageManager.addDependencies).toHaveBeenNthCalledWith(
1,
{ installAsDevDependencies: true },
['@storybook/preview-api@8.1.10', '@storybook/manager-api@8.1.10']
['@storybook/preview-api@8.1.0', '@storybook/manager-api@8.1.0']
);
expect(mockPackageManager.addDependencies).toHaveBeenNthCalledWith(
2,
{ installAsDevDependencies: true, skipInstall: true, packageJson: expect.anything() },
['@storybook/preview-api@^8.1.10', '@storybook/manager-api@^8.1.10']
['@storybook/preview-api@8.1.0', '@storybook/manager-api@8.1.0']
);
});
});

View File

@ -3,7 +3,7 @@ import { readFile } from 'node:fs/promises';
import { dedent } from 'ts-dedent';
import type { Fix } from '../types';
import { getStorybookVersionSpecifier } from '../../helpers';
import { getStorybookVersionSpecifier } from 'storybook/internal/cli';
import type { InstallationMetadata, JsPackageManager } from '@storybook/core/common';
const logger = console;

View File

@ -1,9 +1,9 @@
import { describe, it, expect, vi } from 'vitest';
import type { StorybookConfig } from '@storybook/core/types';
import type { StorybookConfig } from 'storybook/internal/types';
import * as findUp from 'find-up';
import * as rendererHelpers from '../helpers/detectRenderer';
import { newFrameworks } from './new-frameworks';
import type { JsPackageManager } from '@storybook/core/common';
import type { JsPackageManager } from 'storybook/internal/common';
vi.mock('find-up');
vi.mock('../helpers/detectRenderer', async (importOriginal) => ({

View File

@ -1,12 +1,12 @@
import chalk from 'chalk';
import { dedent } from 'ts-dedent';
import semver from 'semver';
import { frameworkPackages, rendererPackages } from '@storybook/core/common';
import { frameworkPackages, rendererPackages } from 'storybook/internal/common';
import type { Preset } from '@storybook/core/types';
import type { Preset } from 'storybook/internal/types';
import invariant from 'tiny-invariant';
import type { Fix } from '../types';
import { getStorybookVersionSpecifier } from '../../helpers';
import { getStorybookVersionSpecifier } from 'storybook/internal/cli';
import {
getNextjsAddonOptions,
detectBuilderInfo,

View File

@ -1,8 +1,8 @@
import { vi, describe, it, expect } from 'vitest';
import type { StorybookConfig } from '@storybook/core/types';
import type { StorybookConfig } from 'storybook/internal/types';
import { glob } from 'glob';
import { removeReactDependency } from './prompt-remove-react';
import type { JsPackageManager } from '@storybook/core/common';
import type { JsPackageManager } from 'storybook/internal/common';
const check = async ({
packageManagerContent,

View File

@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import type { StorybookConfig } from '@storybook/core/types';
import type { StorybookConfig } from 'storybook/internal/types';
import { reactDocgen } from './react-docgen';
const check = async ({

View File

@ -2,7 +2,7 @@ import type { Fix } from '../types';
import * as fs from 'node:fs/promises';
import * as babel from '@babel/core';
import type { BabelFile, NodePath } from '@babel/core';
import { babelParse } from '@storybook/core/csf-tools';
import { babelParse } from 'storybook/internal/csf-tools';
import { dedent } from 'ts-dedent';
import chalk from 'chalk';

View File

@ -3,7 +3,7 @@ import { describe, it, expect, vi } from 'vitest';
import path from 'path';
import * as fsExtra from 'fs-extra';
import type { JsPackageManager } from '@storybook/core/common';
import type { JsPackageManager } from 'storybook/internal/common';
import { RemovedAPIs, removedGlobalClientAPIs as migration } from './remove-global-client-apis';
vi.mock('fs-extra', async () => import('../../../../../__mocks__/fs-extra'));

View File

@ -1,7 +1,7 @@
import { expect, it } from 'vitest';
import type { StorybookConfig } from '@storybook/core/types';
import type { JsPackageManager } from '@storybook/core/common';
import type { StorybookConfig } from 'storybook/internal/types';
import type { JsPackageManager } from 'storybook/internal/common';
import { removeJestTestingLibrary } from './remove-jest-testing-library';
import ansiRegex from 'ansi-regex';

View File

@ -1,7 +1,7 @@
import chalk from 'chalk';
import { dedent } from 'ts-dedent';
import type { Fix } from '../types';
import { getStorybookVersionSpecifier } from '../../helpers';
import { getStorybookVersionSpecifier } from 'storybook/internal/cli';
import { runCodemod } from '@storybook/codemod';
import prompts from 'prompts';

View File

@ -1,6 +1,6 @@
import { dedent } from 'ts-dedent';
import { writeConfig } from '@storybook/core/csf-tools';
import { writeConfig } from 'storybook/internal/csf-tools';
import type { Fix } from '../types';
import { updateMainConfig } from '../helpers/mainConfigFile';

View File

@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import type { JsPackageManager } from '@storybook/core/common';
import type { JsPackageManager } from 'storybook/internal/common';
import { sbBinary } from './sb-binary';
const checkStorybookBinary = async ({

View File

@ -1,8 +1,8 @@
import chalk from 'chalk';
import { dedent } from 'ts-dedent';
import type { Fix } from '../types';
import { getStorybookVersionSpecifier } from '../../helpers';
import type { PackageJsonWithDepsAndDevDeps } from '@storybook/core/common';
import { getStorybookVersionSpecifier } from 'storybook/internal/cli';
import type { PackageJsonWithDepsAndDevDeps } from 'storybook/internal/common';
interface SbBinaryRunOptions {
storybookVersion: string;

View File

@ -1,5 +1,5 @@
import { describe, afterEach, it, expect, vi } from 'vitest';
import type { JsPackageManager } from '@storybook/core/common';
import type { JsPackageManager } from 'storybook/internal/common';
import { getStorybookScripts, sbScripts } from './sb-scripts';
const checkSbScripts = async ({

View File

@ -1,9 +1,9 @@
import chalk from 'chalk';
import { dedent } from 'ts-dedent';
import semver from 'semver';
import type { PackageJson } from '@storybook/core/types';
import type { PackageJson } from 'storybook/internal/types';
import type { Fix } from '../types';
import type { PackageJsonWithDepsAndDevDeps } from '@storybook/core/common';
import type { PackageJsonWithDepsAndDevDeps } from 'storybook/internal/common';
interface SbScriptsRunOptions {
storybookScripts: Record<string, { before: string; after: string }>;

View File

@ -1,8 +1,8 @@
import { describe, afterEach, it, expect, vi } from 'vitest';
import type { StorybookConfig } from '@storybook/core/types';
import type { StorybookConfig } from 'storybook/internal/types';
import { storyshotsMigration } from './storyshots-migration';
import type { JsPackageManager } from '@storybook/core/common';
import type { JsPackageManager } from 'storybook/internal/common';
const check = async ({
packageManager,

View File

@ -1,6 +1,6 @@
import { describe, afterEach, it, expect, vi } from 'vitest';
import type { StorybookConfig } from '@storybook/core/types';
import type { JsPackageManager } from '@storybook/core/common';
import type { StorybookConfig } from 'storybook/internal/types';
import type { JsPackageManager } from 'storybook/internal/common';
import * as docsUtils from '../../doctor/getIncompatibleStorybookPackages';
import { upgradeStorybookRelatedDependencies } from './upgrade-storybook-related-dependencies';

View File

@ -1,8 +1,8 @@
import { dedent } from 'ts-dedent';
import { cyan, yellow } from 'chalk';
import { gt } from 'semver';
import type { JsPackageManager } from '@storybook/core/common';
import { isCorePackage } from '@storybook/core/common';
import type { JsPackageManager } from 'storybook/internal/common';
import { isCorePackage } from 'storybook/internal/common';
import type { Fix } from '../types';
import { getIncompatibleStorybookPackages } from '../../doctor/getIncompatibleStorybookPackages';

View File

@ -2,8 +2,8 @@ import { dedent } from 'ts-dedent';
import type { Fix } from '../types';
import findUp from 'find-up';
import { getFrameworkPackageName } from '../helpers/mainConfigFile';
import { frameworkToRenderer } from '../../helpers';
import { frameworkPackages } from '@storybook/core/common';
import { frameworkToRenderer } from 'storybook/internal/cli';
import { frameworkPackages } from 'storybook/internal/common';
import path from 'path';
interface ViteConfigFileRunOptions {

View File

@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import type { StorybookConfig } from '@storybook/core/types';
import type { StorybookConfig } from 'storybook/internal/types';
import { vta } from './vta';
const check = async ({

View File

@ -1,6 +1,6 @@
import { describe, afterEach, it, expect, vi } from 'vitest';
import type { StorybookConfig } from '@storybook/core/types';
import type { JsPackageManager } from '@storybook/core/common';
import type { StorybookConfig } from 'storybook/internal/types';
import type { JsPackageManager } from 'storybook/internal/common';
import { vue3 } from './vue3';
const checkVue3 = async ({

View File

@ -1,8 +1,8 @@
import { vi, describe, it, expect } from 'vitest';
import type { StorybookConfig } from '@storybook/core/types';
import type { JsPackageManager } from '@storybook/core/common';
import type { StorybookConfig } from 'storybook/internal/types';
import type { JsPackageManager } from 'storybook/internal/common';
import { webpack5CompilerSetup } from './webpack5-compiler-setup';
import { CoreWebpackCompilers } from '../../project_types';
import { CoreWebpackCompilers } from 'storybook/internal/cli';
const check = async ({
packageManager,

View File

@ -1,6 +1,6 @@
import prompts from 'prompts';
import type { SupportedFrameworks } from '@storybook/core/types';
import { frameworkPackages } from '@storybook/core/common';
import type { SupportedFrameworks } from 'storybook/internal/types';
import { frameworkPackages } from 'storybook/internal/common';
import type { Fix } from '../types';
import {
getAddonNames,
@ -9,13 +9,13 @@ import {
getFrameworkPackageName,
updateMainConfig,
} from '../helpers/mainConfigFile';
import { frameworkToDefaultBuilder } from '../../helpers';
import { frameworkToDefaultBuilder } from 'storybook/internal/cli';
import {
CoreBuilder,
CoreWebpackCompilers,
builderNameToCoreBuilder,
compilerNameToCoreCompiler,
} from '../../project_types';
} from 'storybook/internal/cli';
import { dedent } from 'ts-dedent';
import chalk from 'chalk';
import { add } from '../../add';

View File

@ -1,6 +1,6 @@
import { describe, afterEach, it, expect, vi } from 'vitest';
import type { StorybookConfig } from '@storybook/core/types';
import type { JsPackageManager } from '@storybook/core/common';
import type { StorybookConfig } from 'storybook/internal/types';
import type { JsPackageManager } from 'storybook/internal/common';
import { webpack5 } from './webpack5';
const checkWebpack5 = async ({

View File

@ -1,5 +1,5 @@
import * as t from '@babel/types';
import type { ConfigFile } from '@storybook/core/csf-tools';
import type { ConfigFile } from 'storybook/internal/csf-tools';
const defaultRequireWrapperName = 'getAbsolutePath';

View File

@ -1,10 +1,10 @@
import type { MockInstance } from 'vitest';
import { describe, it, expect, vi } from 'vitest';
import { wrapRequire } from './wrap-require';
import * as detect from '../../detect';
import * as detect from 'storybook/internal/cli';
vi.mock('../../detect', async (importOriginal) => ({
...(await importOriginal<typeof import('../../detect')>()),
vi.mock('storybook/internal/cli', async (importOriginal) => ({
...(await importOriginal<typeof import('storybook/internal/cli')>()),
detectPnp: vi.fn(),
}));

View File

@ -1,8 +1,8 @@
import chalk from 'chalk';
import { dedent } from 'ts-dedent';
import { readConfig } from '@storybook/core/csf-tools';
import { readConfig } from 'storybook/internal/csf-tools';
import type { Fix } from '../types';
import { detectPnp } from '../../detect';
import { detectPnp } from 'storybook/internal/cli';
import { updateMainConfig } from '../helpers/mainConfigFile';
import {
getFieldsForRequireWrapper,

View File

@ -1,6 +1,6 @@
import type { MockInstance } from 'vitest';
import { describe, beforeEach, afterEach, it, expect, vi } from 'vitest';
import type { StorybookConfigRaw } from '@storybook/core/types';
import type { StorybookConfigRaw } from 'storybook/internal/types';
import { checkWebpack5Builder } from './checkWebpack5Builder';
import { getBuilderPackageName } from './mainConfigFile';

View File

@ -1,7 +1,7 @@
import chalk from 'chalk';
import semver from 'semver';
import { dedent } from 'ts-dedent';
import type { StorybookConfigRaw } from '@storybook/core/types';
import type { StorybookConfigRaw } from 'storybook/internal/types';
import { getBuilderPackageName } from './mainConfigFile';
const logger = console;

Some files were not shown because too many files have changed in this diff Show More