mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-06 01:01:06 +08:00
CLI: rax
This commit is contained in:
parent
99ee69796a
commit
fff09169fe
@ -1,4 +1,3 @@
|
||||
/* eslint-disable react/prop-types, jsx-a11y/anchor-is-valid */
|
||||
import { createElement } from 'rax';
|
||||
import View from 'rax-view';
|
||||
import Text from 'rax-text';
|
@ -1,24 +1,8 @@
|
||||
import { getBabelDependencies, copyTemplate } from '../../helpers';
|
||||
import { Generator } from '../Generator';
|
||||
import { baseGenerator, Generator } from '../generator';
|
||||
import { writePackageJson } from '../../js-package-manager';
|
||||
|
||||
const generator: Generator = async (packageManager, npmOptions, { storyFormat }) => {
|
||||
const [
|
||||
storybookVersion,
|
||||
actionsVersion,
|
||||
linksVersion,
|
||||
addonsVersion,
|
||||
latestRaxVersion,
|
||||
] = await packageManager.getVersions(
|
||||
'@storybook/rax',
|
||||
'@storybook/addon-actions',
|
||||
'@storybook/addon-links',
|
||||
'@storybook/addons',
|
||||
'rax'
|
||||
);
|
||||
|
||||
copyTemplate(__dirname, storyFormat);
|
||||
|
||||
const generator: Generator = async (packageManager, npmOptions, options) => {
|
||||
const [latestRaxVersion] = await packageManager.getVersions('rax');
|
||||
const packageJson = packageManager.retrievePackageJson();
|
||||
|
||||
const raxVersion = packageJson.dependencies.rax || latestRaxVersion;
|
||||
@ -34,17 +18,9 @@ const generator: Generator = async (packageManager, npmOptions, { storyFormat })
|
||||
|
||||
writePackageJson(packageJson);
|
||||
|
||||
const babelDependencies = await getBabelDependencies(packageManager, packageJson);
|
||||
|
||||
packageManager.addDependencies({ ...npmOptions, packageJson }, [
|
||||
`@storybook/rax@${storybookVersion}`,
|
||||
`@storybook/addon-actions@${actionsVersion}`,
|
||||
`@storybook/addon-links@${linksVersion}`,
|
||||
`@storybook/addons@${addonsVersion}`,
|
||||
...babelDependencies,
|
||||
]);
|
||||
|
||||
packageManager.addStorybookCommandInScripts();
|
||||
baseGenerator(packageManager, npmOptions, options, 'rax', {
|
||||
extraPackages: ['rax'],
|
||||
});
|
||||
};
|
||||
|
||||
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