From 6a6d6dd4c766706020b024fc177b8aa420f7641f Mon Sep 17 00:00:00 2001 From: Daniel Duan Date: Sat, 28 Oct 2017 17:53:02 -0400 Subject: [PATCH] auto import stories --- examples/cra-kitchen-sink/.storybook/config.js | 8 ++++++-- .../src/stories/{index.js => index.stories.js} | 0 ...book-components.js => storybook-components.stories.js} | 0 3 files changed, 6 insertions(+), 2 deletions(-) rename examples/cra-kitchen-sink/src/stories/{index.js => index.stories.js} (100%) rename examples/cra-kitchen-sink/src/stories/{storybook-components.js => storybook-components.stories.js} (100%) diff --git a/examples/cra-kitchen-sink/.storybook/config.js b/examples/cra-kitchen-sink/.storybook/config.js index c21ef8b46b4..56f54c6d358 100644 --- a/examples/cra-kitchen-sink/.storybook/config.js +++ b/examples/cra-kitchen-sink/.storybook/config.js @@ -1,5 +1,7 @@ import { configure, setAddon } from '@storybook/react'; import { setOptions } from '@storybook/addon-options'; + +// deprecated usage of infoAddon import infoAddon from '@storybook/addon-info'; setOptions({ @@ -14,11 +16,13 @@ setOptions({ hierarchySeparator: /\/|\./, }); +// deprecated usage of infoAddon setAddon(infoAddon); +const req = require.context('../src/stories', true, /\.stories\.js$/) + function loadStories() { - require('../src/stories/index'); - require('../src/stories/storybook-components'); + req.keys().forEach((filename) => req(filename)) } configure(loadStories, module); diff --git a/examples/cra-kitchen-sink/src/stories/index.js b/examples/cra-kitchen-sink/src/stories/index.stories.js similarity index 100% rename from examples/cra-kitchen-sink/src/stories/index.js rename to examples/cra-kitchen-sink/src/stories/index.stories.js diff --git a/examples/cra-kitchen-sink/src/stories/storybook-components.js b/examples/cra-kitchen-sink/src/stories/storybook-components.stories.js similarity index 100% rename from examples/cra-kitchen-sink/src/stories/storybook-components.js rename to examples/cra-kitchen-sink/src/stories/storybook-components.stories.js