mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-04 09:51:06 +08:00
ensure the CLI installs the new version of the preset
This commit is contained in:
parent
13acf140c1
commit
0ead7cc115
@ -5,6 +5,7 @@ import semver from 'semver';
|
||||
import { baseGenerator } from '../baseGenerator';
|
||||
import type { Generator } from '../types';
|
||||
import { CoreBuilder } from '../../project_types';
|
||||
import versions from '../../versions';
|
||||
|
||||
const generator: Generator = async (packageManager, npmOptions, options) => {
|
||||
const monorepoRootPath = path.join(__dirname, '..', '..', '..', '..', '..', '..');
|
||||
@ -28,8 +29,8 @@ const generator: Generator = async (packageManager, npmOptions, options) => {
|
||||
)?.version;
|
||||
const isCra5 = craVersion && semver.gte(craVersion, '5.0.0');
|
||||
const updatedOptions = isCra5 ? { ...options, builder: CoreBuilder.Webpack5 } : options;
|
||||
// `@storybook/preset-create-react-app` has `@storybook/node-logger` as peerDep
|
||||
const extraPackages = ['@storybook/node-logger'];
|
||||
|
||||
const extraPackages = [];
|
||||
if (isCra5) {
|
||||
extraPackages.push('webpack');
|
||||
// Miscellaneous dependency used in `babel-preset-react-app` but not listed as dep there
|
||||
@ -38,8 +39,8 @@ const generator: Generator = async (packageManager, npmOptions, options) => {
|
||||
extraPackages.push('prop-types');
|
||||
}
|
||||
|
||||
// preset v3 is compat with older versions of CRA, otherwise let version float
|
||||
const extraAddons = [`@storybook/preset-create-react-app${isCra5 ? '' : '@3'}`];
|
||||
const version = versions['@storybook/preset-create-react-app'];
|
||||
const extraAddons = [`@storybook/preset-create-react-app@${version}`];
|
||||
|
||||
await baseGenerator(packageManager, npmOptions, updatedOptions, 'react', {
|
||||
extraAddons,
|
||||
|
@ -19,8 +19,7 @@ export default {
|
||||
'@storybook/addon-viewport': '7.0.0-beta.50',
|
||||
'@storybook/addons': '7.0.0-beta.50',
|
||||
'@storybook/angular': '7.0.0-beta.50',
|
||||
'@storybook/manager-api': '7.0.0-beta.50',
|
||||
'@storybook/blocks': '7.0.0-beta.50',
|
||||
'@storybook/api': '7.0.0-beta.50',
|
||||
'@storybook/builder-manager': '7.0.0-beta.50',
|
||||
'@storybook/builder-vite': '7.0.0-beta.50',
|
||||
'@storybook/builder-webpack5': '7.0.0-beta.50',
|
||||
@ -31,25 +30,27 @@ export default {
|
||||
'@storybook/client-api': '7.0.0-beta.50',
|
||||
'@storybook/client-logger': '7.0.0-beta.50',
|
||||
'@storybook/codemod': '7.0.0-beta.50',
|
||||
'@storybook/components': '7.0.0-beta.50',
|
||||
'@storybook/core-client': '7.0.0-beta.50',
|
||||
'@storybook/core-common': '7.0.0-beta.50',
|
||||
'@storybook/core-events': '7.0.0-beta.50',
|
||||
'@storybook/core-server': '7.0.0-beta.50',
|
||||
'@storybook/core-webpack': '7.0.0-beta.50',
|
||||
'@storybook/csf-plugin': '7.0.0-beta.50',
|
||||
'@storybook/csf-tools': '7.0.0-beta.50',
|
||||
'@storybook/docs-tools': '7.0.0-beta.50',
|
||||
'@storybook/ember': '7.0.0-beta.50',
|
||||
'@storybook/html': '7.0.0-beta.50',
|
||||
'@storybook/html-webpack5': '7.0.0-beta.50',
|
||||
'@storybook/html-vite': '7.0.0-beta.50',
|
||||
'@storybook/html-webpack5': '7.0.0-beta.50',
|
||||
'@storybook/instrumenter': '7.0.0-beta.50',
|
||||
'@storybook/manager-api': '7.0.0-beta.50',
|
||||
'@storybook/nextjs': '7.0.0-beta.50',
|
||||
'@storybook/node-logger': '7.0.0-beta.50',
|
||||
'@storybook/postinstall': '7.0.0-beta.50',
|
||||
'@storybook/preact': '7.0.0-beta.50',
|
||||
'@storybook/preact-vite': '7.0.0-beta.50',
|
||||
'@storybook/preact-webpack5': '7.0.0-beta.50',
|
||||
'@storybook/preset-create-react-app': '7.0.0-beta.50',
|
||||
'@storybook/preset-html-webpack': '7.0.0-beta.50',
|
||||
'@storybook/preset-preact-webpack': '7.0.0-beta.50',
|
||||
'@storybook/preset-react-webpack': '7.0.0-beta.50',
|
||||
@ -70,12 +71,12 @@ export default {
|
||||
'@storybook/source-loader': '7.0.0-beta.50',
|
||||
'@storybook/store': '7.0.0-beta.50',
|
||||
'@storybook/svelte': '7.0.0-beta.50',
|
||||
'@storybook/sveltekit': '7.0.0-beta.50',
|
||||
'@storybook/svelte-vite': '7.0.0-beta.50',
|
||||
'@storybook/svelte-webpack5': '7.0.0-beta.50',
|
||||
'@storybook/sveltekit': '7.0.0-beta.50',
|
||||
'@storybook/telemetry': '7.0.0-beta.50',
|
||||
'@storybook/theming': '7.0.0-beta.50',
|
||||
'@storybook/manager': '7.0.0-beta.50',
|
||||
'@storybook/types': '7.0.0-beta.50',
|
||||
'@storybook/vue': '7.0.0-beta.50',
|
||||
'@storybook/vue-vite': '7.0.0-beta.50',
|
||||
'@storybook/vue-webpack5': '7.0.0-beta.50',
|
||||
@ -83,8 +84,8 @@ export default {
|
||||
'@storybook/vue3-vite': '7.0.0-beta.50',
|
||||
'@storybook/vue3-webpack5': '7.0.0-beta.50',
|
||||
'@storybook/web-components': '7.0.0-beta.50',
|
||||
'@storybook/web-components-webpack5': '7.0.0-beta.50',
|
||||
'@storybook/web-components-vite': '7.0.0-beta.50',
|
||||
'@storybook/web-components-webpack5': '7.0.0-beta.50',
|
||||
sb: '7.0.0-beta.50',
|
||||
storybook: '7.0.0-beta.50',
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user