CLI: riot

This commit is contained in:
tooppaaa 2020-06-11 23:32:19 +02:00
parent f3a84a699a
commit 898d9250ce
6 changed files with 5 additions and 52 deletions

View File

@ -1,52 +1,9 @@
import { getBabelDependencies, copyTemplate } from '../../helpers';
import { Generator } from '../Generator';
import { writePackageJson } from '../../js-package-manager';
import { baseGenerator, Generator } from '../generator';
const generator: Generator = async (packageManager, npmOptions, { storyFormat }) => {
const [
storybookVersion,
actionsVersion,
linksVersion,
addonsVersion,
tagLoaderVersion,
] = await packageManager.getVersions(
'@storybook/riot',
'@storybook/addon-actions',
'@storybook/addon-links',
'@storybook/addons',
'riot-tag-loader'
);
copyTemplate(__dirname, storyFormat);
const packageJson = packageManager.retrievePackageJson();
packageJson.dependencies = packageJson.dependencies || {};
packageJson.devDependencies = packageJson.devDependencies || {};
const dependencies = [
`@storybook/riot@${storybookVersion}`,
`@storybook/addon-actions@${actionsVersion}`,
`@storybook/addon-links@${linksVersion}`,
`@storybook/addons@${addonsVersion}`,
];
if (
!packageJson.devDependencies['riot-tag-loader'] &&
!packageJson.dependencies['riot-tag-loader']
) {
dependencies.push(`riot-tag-loader@${tagLoaderVersion}`);
}
writePackageJson(packageJson);
const babelDependencies = await getBabelDependencies(packageManager, packageJson);
packageManager.addDependencies({ ...npmOptions, packageJson }, [
...dependencies,
...babelDependencies,
]);
packageManager.addStorybookCommandInScripts();
const generator: Generator = async (packageManager, npmOptions, options) => {
baseGenerator(packageManager, npmOptions, options, 'riot', {
extraPackages: ['riot-tag-loader'],
});
};
export default generator;

View File

@ -1,4 +0,0 @@
module.exports = {
stories: ['../stories/**/*.stories.js'],
addons: ['@storybook/addon-actions', '@storybook/addon-links'],
};