mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-05 16:11:33 +08:00
CLI: riot
This commit is contained in:
parent
f3a84a699a
commit
898d9250ce
@ -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;
|
||||
|
@ -1,4 +0,0 @@
|
||||
module.exports = {
|
||||
stories: ['../stories/**/*.stories.js'],
|
||||
addons: ['@storybook/addon-actions', '@storybook/addon-links'],
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user