Skip to content

Commit

Permalink
fix(cli): use the same list of addons to build main.js as the one a…
Browse files Browse the repository at this point in the history
…dded during init
  • Loading branch information
gaetanmaisse committed Jun 9, 2020
1 parent fbb5d89 commit 2570a66
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
9 changes: 2 additions & 7 deletions lib/cli/src/generators/configure.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import fse from 'fs-extra';

function mainConfigurationGenerator(addons?: string[], custom?: any) {
function mainConfigurationGenerator(addons: string[], custom?: any) {
const hasSrc = fse.existsSync('./src');

const config = {
stories: [!hasSrc && '../stories/**/*.stories.*', hasSrc && '../src/**/*.stories.*'].filter(
Boolean
),
addons: [
'@storybook/addon-actions',
'@storybook/addon-links',
'@storybook/addon-docs',
...addons,
],
addons,
...custom,
};

Expand Down
20 changes: 11 additions & 9 deletions lib/cli/src/generators/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,20 @@ const generator = async (
...defaultOptions,
...options,
};
const packages = [
`@storybook/${framework}`,
// https://github.com/storybookjs/storybook/issues/9103
framework !== 'angular' && '@storybook/addon-essentials',
'@storybook/addon-actions',

const addons = [
'@storybook/addon-links',
...extraPackages,
...extraAddons,
].filter(Boolean);
// If angular add only `actions` because docs is buggy for now (https://github.com/storybookjs/storybook/issues/9103)
// for others framework add `essentials` i.e. `actions`, `backgrounds`, `docs`, `viewport`
framework !== 'angular' ? '@storybook/addon-essentials' : '@storybook/addon-actions',
];

const packages = [`@storybook/${framework}`, ...addons, ...extraPackages, ...extraAddons].filter(
Boolean
);
const versionedPackages = await getVersionedPackages(npmOptions, ...packages);

configure(extraAddons);
configure([...addons, ...extraAddons]);
if (addComponents) {
copyComponents(framework, language);
}
Expand Down

0 comments on commit 2570a66

Please sign in to comment.