import path from 'path'; import fse from 'fs-extra'; import { getVersions, getPackageJson, writePackageJson, getBabelDependencies, installDependencies, } from '../../lib/helpers'; export default async npmOptions => { const [storybookVersion, actionsVersion, linksVersion, addonsVersion] = await getVersions( npmOptions, '@storybook/mithril', '@storybook/addon-actions', '@storybook/addon-links', '@storybook/addons' ); fse.copySync(path.resolve(__dirname, 'template/'), '.', { overwrite: true }); 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, [ `@storybook/mithril@${storybookVersion}`, `@storybook/addon-actions@${actionsVersion}`, `@storybook/addon-links@${linksVersion}`, `@storybook/addons@${addonsVersion}`, ...babelDependencies, ]); };