From f496deba0b250720bc90f84e5a1c43e045af8e42 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Thu, 22 Jun 2017 15:05:19 +1000 Subject: [PATCH] Create `@storybook/react/demo` exports --- addons/storyshots/stories/directly_required/index.js | 3 +-- .../stories/required_with_context/Button.stories.js | 3 +-- .../stories/required_with_context/Welcome.stories.js | 3 +-- app/react/demo.js | 5 +++++ app/react/src/demo/index.js | 4 ---- examples/cra-kitchen-sink/src/stories/index.js | 2 +- examples/test-cra/src/stories/index.js | 2 +- lib/cli/generators/METEOR/template/.stories/index.js | 2 +- lib/cli/generators/REACT/template/stories/index.js | 2 +- .../generators/REACT_SCRIPTS/template/src/stories/index.js | 2 +- lib/cli/generators/WEBPACK_REACT/template/stories/index.js | 2 +- 11 files changed, 14 insertions(+), 16 deletions(-) create mode 100644 app/react/demo.js delete mode 100644 app/react/src/demo/index.js diff --git a/addons/storyshots/stories/directly_required/index.js b/addons/storyshots/stories/directly_required/index.js index c3d336eec8cf..0b6cb2f94f98 100644 --- a/addons/storyshots/stories/directly_required/index.js +++ b/addons/storyshots/stories/directly_required/index.js @@ -2,8 +2,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; // eslint-disable-line import { action } from '@storybook/addon-actions'; // eslint-disable-line - -import Button from '@storybook/react/dist/demo/Button'; +import { Button } from '@storybook/react/demo'; storiesOf('Another Button', module) .add('with text', () => ) diff --git a/addons/storyshots/stories/required_with_context/Button.stories.js b/addons/storyshots/stories/required_with_context/Button.stories.js index 34dc04a9b528..27496bf316cd 100644 --- a/addons/storyshots/stories/required_with_context/Button.stories.js +++ b/addons/storyshots/stories/required_with_context/Button.stories.js @@ -2,8 +2,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; // eslint-disable-line import { action } from '@storybook/addon-actions'; // eslint-disable-line - -import Button from '@storybook/react/dist/demo/Button'; +import { Button } from '@storybook/react/demo'; storiesOf('Button', module) .add('with text', () => ) diff --git a/addons/storyshots/stories/required_with_context/Welcome.stories.js b/addons/storyshots/stories/required_with_context/Welcome.stories.js index fd6f43e163b5..bec79b78a258 100644 --- a/addons/storyshots/stories/required_with_context/Welcome.stories.js +++ b/addons/storyshots/stories/required_with_context/Welcome.stories.js @@ -2,7 +2,6 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; // eslint-disable-line import { linkTo } from '@storybook/addon-links'; // eslint-disable-line - -import Welcome from '@storybook/react/dist/demo/Welcome'; +import { Welcome } from '@storybook/react/demo'; storiesOf('Welcome', module).add('to Storybook', () => ); diff --git a/app/react/demo.js b/app/react/demo.js new file mode 100644 index 000000000000..74b00540e9e4 --- /dev/null +++ b/app/react/demo.js @@ -0,0 +1,5 @@ +/* eslint-disable global-require */ +module.exports = { + Welcome: require('./dist/demo/Welcome').default, + Button: require('./dist/demo/Button').default, +}; diff --git a/app/react/src/demo/index.js b/app/react/src/demo/index.js deleted file mode 100644 index b23c438e2659..000000000000 --- a/app/react/src/demo/index.js +++ /dev/null @@ -1,4 +0,0 @@ -import Welcome from './Welcome'; -import Button from './Button'; - -export { Welcome, Button }; diff --git a/examples/cra-kitchen-sink/src/stories/index.js b/examples/cra-kitchen-sink/src/stories/index.js index b05db04098fa..fabd50e219a2 100644 --- a/examples/cra-kitchen-sink/src/stories/index.js +++ b/examples/cra-kitchen-sink/src/stories/index.js @@ -19,7 +19,7 @@ import { } from '@storybook/addon-knobs'; import centered from '@storybook/addon-centered'; -import { Button, Welcome } from '@storybook/react/dist/demo'; +import { Button, Welcome } from '@storybook/react/demo'; import App from '../App'; import Logger from './Logger'; diff --git a/examples/test-cra/src/stories/index.js b/examples/test-cra/src/stories/index.js index bea85f048547..d86c08937a16 100644 --- a/examples/test-cra/src/stories/index.js +++ b/examples/test-cra/src/stories/index.js @@ -4,7 +4,7 @@ import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { linkTo } from '@storybook/addon-links'; -import { Button, Welcome } from '@storybook/react/dist/demo'; +import { Button, Welcome } from '@storybook/react/demo'; import ComponentWithRef from './ComponentWithRef'; storiesOf('Welcome', module).add('to Storybook', () => ); diff --git a/lib/cli/generators/METEOR/template/.stories/index.js b/lib/cli/generators/METEOR/template/.stories/index.js index fdbca148cf79..c0062d92e548 100644 --- a/lib/cli/generators/METEOR/template/.stories/index.js +++ b/lib/cli/generators/METEOR/template/.stories/index.js @@ -6,7 +6,7 @@ import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { linkTo } from '@storybook/addon-links'; -import { Button, Welcome } from '@storybook/react/dist/demo'; +import { Button, Welcome } from '@storybook/react/demo'; storiesOf('Welcome', module) .add('to Storybook', () => ( diff --git a/lib/cli/generators/REACT/template/stories/index.js b/lib/cli/generators/REACT/template/stories/index.js index 391cf041924a..9214f65c7bb5 100644 --- a/lib/cli/generators/REACT/template/stories/index.js +++ b/lib/cli/generators/REACT/template/stories/index.js @@ -4,7 +4,7 @@ import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { linkTo } from '@storybook/addon-links'; -import { Button, Welcome } from '@storybook/react/dist/demo'; +import { Button, Welcome } from '@storybook/react/demo'; storiesOf('Welcome', module).add('to Storybook', () => ); diff --git a/lib/cli/generators/REACT_SCRIPTS/template/src/stories/index.js b/lib/cli/generators/REACT_SCRIPTS/template/src/stories/index.js index 391cf041924a..9214f65c7bb5 100644 --- a/lib/cli/generators/REACT_SCRIPTS/template/src/stories/index.js +++ b/lib/cli/generators/REACT_SCRIPTS/template/src/stories/index.js @@ -4,7 +4,7 @@ import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { linkTo } from '@storybook/addon-links'; -import { Button, Welcome } from '@storybook/react/dist/demo'; +import { Button, Welcome } from '@storybook/react/demo'; storiesOf('Welcome', module).add('to Storybook', () => ); diff --git a/lib/cli/generators/WEBPACK_REACT/template/stories/index.js b/lib/cli/generators/WEBPACK_REACT/template/stories/index.js index 391cf041924a..9214f65c7bb5 100644 --- a/lib/cli/generators/WEBPACK_REACT/template/stories/index.js +++ b/lib/cli/generators/WEBPACK_REACT/template/stories/index.js @@ -4,7 +4,7 @@ import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { linkTo } from '@storybook/addon-links'; -import { Button, Welcome } from '@storybook/react/dist/demo'; +import { Button, Welcome } from '@storybook/react/demo'; storiesOf('Welcome', module).add('to Storybook', () => );