mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-04 22:11:15 +08:00
38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
import fse from 'fs-extra';
|
|
import path from 'path';
|
|
import {
|
|
getVersions,
|
|
getPackageJson,
|
|
writePackageJson,
|
|
getBabelDependencies,
|
|
installDependencies,
|
|
copyTemplate,
|
|
} from '../../lib/helpers';
|
|
|
|
export default async (npmOptions, { storyFormat = 'csf' }) => {
|
|
const packages = [
|
|
'@storybook/vue',
|
|
'@storybook/addon-actions',
|
|
'@storybook/addon-links',
|
|
'@storybook/addons',
|
|
];
|
|
const versionedPackages = await getVersions(npmOptions, packages);
|
|
|
|
copyTemplate(__dirname, storyFormat);
|
|
|
|
const packageJson = getPackageJson();
|
|
|
|
packageJson.dependencies = packageJson.dependencies || {};
|
|
packageJson.devDependencies = packageJson.devDependencies || {};
|
|
|
|
packageJson.scripts = packageJson.scripts || {};
|
|
packageJson.scripts.storybook = 'start-storybook -p 6006';
|
|
packageJson.scripts['build-storybook'] = 'build-storybook';
|
|
|
|
writePackageJson(packageJson);
|
|
|
|
const babelDependencies = await getBabelDependencies(npmOptions, packageJson);
|
|
|
|
installDependencies(npmOptions, [...versionedPackages, ...babelDependencies]);
|
|
};
|