mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 03:41:06 +08:00
27 lines
951 B
JavaScript
27 lines
951 B
JavaScript
import path from 'path';
|
|
import mergeDirs from 'merge-dirs';
|
|
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
|
|
|
export default async () => {
|
|
const [storybookVersion, actionsVersion, linksVersion] = await getVersions(
|
|
'@storybook/react',
|
|
'@storybook/addon-actions',
|
|
'@storybook/addon-links'
|
|
);
|
|
|
|
mergeDirs(path.resolve(__dirname, 'template/'), '.', 'overwrite');
|
|
|
|
const packageJson = getPackageJson();
|
|
|
|
packageJson.devDependencies = packageJson.devDependencies || {};
|
|
packageJson.devDependencies['@storybook/react'] = storybookVersion;
|
|
packageJson.devDependencies['@storybook/addon-actions'] = actionsVersion;
|
|
packageJson.devDependencies['@storybook/addon-links'] = linksVersion;
|
|
|
|
packageJson.scripts = packageJson.scripts || {};
|
|
packageJson.scripts.storybook = 'start-storybook -p 6006';
|
|
packageJson.scripts['build-storybook'] = 'build-storybook';
|
|
|
|
writePackageJson(packageJson);
|
|
};
|