mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-06 15:31:16 +08:00
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
import {
|
|
getVersions,
|
|
getPackageJson,
|
|
writePackageJson,
|
|
getBabelDependencies,
|
|
installDependencies,
|
|
copyTemplate,
|
|
} from '../../lib/helpers';
|
|
|
|
export default async (npmOptions, { storyFormat = 'csf' }) => {
|
|
const [storybookVersion, linksVersion, actionsVersion, addonsVersion] = await getVersions(
|
|
npmOptions,
|
|
'@storybook/ember',
|
|
'@storybook/addon-links',
|
|
'@storybook/addon-actions',
|
|
'@storybook/addons'
|
|
);
|
|
|
|
copyTemplate(__dirname, storyFormat);
|
|
|
|
const packageJson = getPackageJson();
|
|
|
|
packageJson.dependencies = packageJson.dependencies || {};
|
|
packageJson.devDependencies = packageJson.devDependencies || {};
|
|
|
|
packageJson.scripts = {
|
|
...packageJson.scripts,
|
|
...{
|
|
storybook: 'start-storybook -p 6006 -s dist',
|
|
'build-storybook': 'build-storybook -s dist',
|
|
},
|
|
};
|
|
|
|
writePackageJson(packageJson);
|
|
|
|
const babelDependencies = await getBabelDependencies(npmOptions, packageJson);
|
|
|
|
installDependencies(npmOptions, [
|
|
`@storybook/ember@${storybookVersion}`,
|
|
`@storybook/addon-actions@${actionsVersion}`,
|
|
`@storybook/addon-links@${linksVersion}`,
|
|
`@storybook/addons@${addonsVersion}`,
|
|
...babelDependencies,
|
|
]);
|
|
};
|