From e846dc6af79e0cfaee1d29c39c482fd104d5922c Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Fri, 12 May 2017 23:58:50 +1000 Subject: [PATCH 1/3] Deprecate built-in addons Use `action` and `linkTo` addons just like any other storybook addon. Update examples, docs, and add deprecation warning to code. --- examples/cra-storybook/.storybook/addons.js | 2 + examples/cra-storybook/package.json | 3 + examples/cra-storybook/src/stories/index.js | 4 +- examples/test-cra/.storybook/addons.js | 2 + examples/test-cra/package.json | 1 + examples/test-cra/src/stories/index.js | 4 +- packages/addon-actions/.storybook/addons.js | 3 - packages/addon-comments/.storybook/addons.js | 3 - packages/addon-info/.storybook/addons.js | 2 +- packages/addon-info/example/story.js | 3 +- packages/addon-knobs/.storybook/addons.js | 1 - packages/addon-knobs/README.md | 3 - packages/addon-links/.storybook/addons.js | 3 - packages/addon-links/README.md | 3 +- packages/addon-notes/README.md | 1 - packages/addon-options/.storybook/addons.js | 3 - .../METEOR/template/.stories/index.js | 4 +- .../METEOR/template/.storybook/addons.js | 2 + .../REACT/template/.storybook/addons.js | 2 + .../REACT/template/stories/index.js | 4 +- .../REACT_NATIVE/template/storybook/addons.js | 3 +- .../template/storybook/stories/index.js | 4 +- .../template/.storybook/addons.js | 2 + .../template/src/stories/index.js | 4 +- .../docs/manual-setup.md | 3 +- packages/react-native-storybook/package.json | 151 +++++++++--------- packages/react-native-storybook/src/index.js | 15 +- .../src/server/addons.js | 6 + .../react-storybook/demo/.storybook/addons.js | 2 + packages/react-storybook/demo/package.json | 5 +- .../react-storybook/demo/src/stories/index.js | 4 +- packages/react-storybook/package.json | 1 + packages/react-storybook/src/client/index.js | 15 +- packages/react-storybook/src/server/addons.js | 6 + packages/storyshots/package.json | 2 + .../required_with_context/Button.stories.js | 4 +- .../required_with_context/Welcome.stories.js | 3 +- 37 files changed, 172 insertions(+), 111 deletions(-) create mode 100644 examples/cra-storybook/.storybook/addons.js create mode 100644 examples/test-cra/.storybook/addons.js create mode 100644 packages/getstorybook/generators/METEOR/template/.storybook/addons.js create mode 100644 packages/getstorybook/generators/REACT/template/.storybook/addons.js create mode 100644 packages/getstorybook/generators/REACT_SCRIPTS/template/.storybook/addons.js create mode 100644 packages/react-storybook/demo/.storybook/addons.js diff --git a/examples/cra-storybook/.storybook/addons.js b/examples/cra-storybook/.storybook/addons.js new file mode 100644 index 000000000000..e8590efcf2fd --- /dev/null +++ b/examples/cra-storybook/.storybook/addons.js @@ -0,0 +1,2 @@ +import '@kadira/storybook-addon-actions/register'; +import '@kadira/storybook-addon-links/register'; diff --git a/examples/cra-storybook/package.json b/examples/cra-storybook/package.json index 10c0605cc5cf..437fc4720a00 100644 --- a/examples/cra-storybook/package.json +++ b/examples/cra-storybook/package.json @@ -4,6 +4,9 @@ "private": true, "devDependencies": { "@kadira/storybook": "*", + "@kadira/storybook-addons": "*", + "@kadira/storybook-addon-actions": "*", + "@kadira/storybook-addon-links": "*", "react-scripts": "0.9.5" }, "dependencies": { diff --git a/examples/cra-storybook/src/stories/index.js b/examples/cra-storybook/src/stories/index.js index ee5770241712..aab92a8a0eca 100644 --- a/examples/cra-storybook/src/stories/index.js +++ b/examples/cra-storybook/src/stories/index.js @@ -1,5 +1,7 @@ import React from 'react'; -import { storiesOf, action, linkTo } from '@kadira/storybook'; +import { storiesOf } from '@kadira/storybook'; +import { action } from '@kadira/storybook-addon-actions'; +import { linkTo } from '@kadira/storybook-addon-links'; import Button from './Button'; import Welcome from './Welcome'; diff --git a/examples/test-cra/.storybook/addons.js b/examples/test-cra/.storybook/addons.js new file mode 100644 index 000000000000..e8590efcf2fd --- /dev/null +++ b/examples/test-cra/.storybook/addons.js @@ -0,0 +1,2 @@ +import '@kadira/storybook-addon-actions/register'; +import '@kadira/storybook-addon-links/register'; diff --git a/examples/test-cra/package.json b/examples/test-cra/package.json index 2df7940acfee..f65caf56a70a 100644 --- a/examples/test-cra/package.json +++ b/examples/test-cra/package.json @@ -17,6 +17,7 @@ "devDependencies": { "@kadira/storybook": "file:../../packages/react-storybook", "@kadira/storybook-addon-actions": "file:../../packages/addon-actions", + "@kadira/storybook-addon-links": "file:../../packages/addon-links", "@kadira/storybook-addons": "file:../../packages/addons", "@kadira/storybook-channel": "file:../../packages/channel", "@kadira/storybook-channel-postmsg": "file:../../packages/channel-postmessage", diff --git a/examples/test-cra/src/stories/index.js b/examples/test-cra/src/stories/index.js index ee5770241712..aab92a8a0eca 100644 --- a/examples/test-cra/src/stories/index.js +++ b/examples/test-cra/src/stories/index.js @@ -1,5 +1,7 @@ import React from 'react'; -import { storiesOf, action, linkTo } from '@kadira/storybook'; +import { storiesOf } from '@kadira/storybook'; +import { action } from '@kadira/storybook-addon-actions'; +import { linkTo } from '@kadira/storybook-addon-links'; import Button from './Button'; import Welcome from './Welcome'; diff --git a/packages/addon-actions/.storybook/addons.js b/packages/addon-actions/.storybook/addons.js index ec80e21eeaa2..990240ee50fb 100644 --- a/packages/addon-actions/.storybook/addons.js +++ b/packages/addon-actions/.storybook/addons.js @@ -1,6 +1,3 @@ -// Uncomment to register defaults -// import '@kadira/storybook/addons'; - // Use the line below to register this addon // import '@kadira/storybook-addon-actions/register'; import '../register'; diff --git a/packages/addon-comments/.storybook/addons.js b/packages/addon-comments/.storybook/addons.js index f777561483fe..77ece740ce29 100644 --- a/packages/addon-comments/.storybook/addons.js +++ b/packages/addon-comments/.storybook/addons.js @@ -1,6 +1,3 @@ -// Uncomment to register defaults -// import '@kadira/storybook/addons'; - // Use the line below to register this addon // import '@kadira/storybook-addon-comments/register'; import '@kadira/storybook-addon-actions/register'; diff --git a/packages/addon-info/.storybook/addons.js b/packages/addon-info/.storybook/addons.js index 396231a47db1..30ef6a90abce 100644 --- a/packages/addon-info/.storybook/addons.js +++ b/packages/addon-info/.storybook/addons.js @@ -1,2 +1,2 @@ -import '@kadira/storybook/addons'; +import '@kadira/storybook-addon-actions/register'; import 'react-storybook-addon-backgrounds/register'; diff --git a/packages/addon-info/example/story.js b/packages/addon-info/example/story.js index e24e26a5b0d8..abe8cbf13170 100644 --- a/packages/addon-info/example/story.js +++ b/packages/addon-info/example/story.js @@ -1,6 +1,7 @@ import React from 'react'; import Button from './Button'; -import { storiesOf, action } from '@kadira/storybook'; +import { storiesOf } from '@kadira/storybook'; +import { action } from '@kadira/storybook-addon-actions'; import backgrounds from 'react-storybook-addon-backgrounds'; storiesOf('Button').addWithInfo( diff --git a/packages/addon-knobs/.storybook/addons.js b/packages/addon-knobs/.storybook/addons.js index bba2c778e12e..d33eec83877b 100644 --- a/packages/addon-knobs/.storybook/addons.js +++ b/packages/addon-knobs/.storybook/addons.js @@ -1,2 +1 @@ import '../src/register'; -import '@kadira/storybook/addons' diff --git a/packages/addon-knobs/README.md b/packages/addon-knobs/README.md index 2f5743563b76..8217f7194bd5 100644 --- a/packages/addon-knobs/README.md +++ b/packages/addon-knobs/README.md @@ -20,9 +20,6 @@ npm i -D @kadira/storybook-addon-knobs Then, configure it as an addon by adding it to your `addons.js` file (located in the Storybook config directory). ```js -// To get our default addons (actions and links) -import '@kadira/storybook/addons'; -// To add the knobs addon import '@kadira/storybook-addon-knobs/register' ``` diff --git a/packages/addon-links/.storybook/addons.js b/packages/addon-links/.storybook/addons.js index 25315237a045..ed46b38dad88 100644 --- a/packages/addon-links/.storybook/addons.js +++ b/packages/addon-links/.storybook/addons.js @@ -1,6 +1,3 @@ -// Uncomment to register defaults -// import '@kadira/storybook/addons'; - // Use the line below to register this addon // import '@kadira/storybook-addon-links/register'; import '../register'; diff --git a/packages/addon-links/README.md b/packages/addon-links/README.md index cf57b0ef9ada..e0edaf451759 100644 --- a/packages/addon-links/README.md +++ b/packages/addon-links/README.md @@ -7,7 +7,8 @@ The Story Links addon can be used to create links between stories. This addon wo You can use this addon without installing it. ```js -import { storiesOf, linkTo } from '@kadira/storybook' +import { storiesOf } from '@kadira/storybook' +import { linkTo } from '@kadira/storybook-addon-links' storiesOf('Button', module) .add('First', () => ( diff --git a/packages/addon-notes/README.md b/packages/addon-notes/README.md index 12f2699a02a5..33ba04da87c1 100644 --- a/packages/addon-notes/README.md +++ b/packages/addon-notes/README.md @@ -16,7 +16,6 @@ Then create a file called `addons.js` in your storybook config. Add following content to it: ```js -import '@kadira/storybook/addons'; import '@kadira/storybook-addon-notes/register'; ``` diff --git a/packages/addon-options/.storybook/addons.js b/packages/addon-options/.storybook/addons.js index a62e1811af54..b9a4a1122979 100644 --- a/packages/addon-options/.storybook/addons.js +++ b/packages/addon-options/.storybook/addons.js @@ -1,6 +1,3 @@ -// Uncomment to register defaults -// import '@kadira/storybook/addons'; - // Use the line below to register this addon // import '@kadira/storybook-addon-hello/register'; import '../register'; diff --git a/packages/getstorybook/generators/METEOR/template/.stories/index.js b/packages/getstorybook/generators/METEOR/template/.stories/index.js index cd66c187d783..95b016935243 100644 --- a/packages/getstorybook/generators/METEOR/template/.stories/index.js +++ b/packages/getstorybook/generators/METEOR/template/.stories/index.js @@ -1,5 +1,7 @@ import React from 'react'; -import { storiesOf, action, linkTo } from '@kadira/storybook'; +import { storiesOf } from '@kadira/react-native-storybook'; +import { action } from '@kadira/storybook-addon-actions'; +import { linkTo } from '@kadira/storybook-addon-links'; import Button from './Button'; import Welcome from './Welcome'; diff --git a/packages/getstorybook/generators/METEOR/template/.storybook/addons.js b/packages/getstorybook/generators/METEOR/template/.storybook/addons.js new file mode 100644 index 000000000000..e8590efcf2fd --- /dev/null +++ b/packages/getstorybook/generators/METEOR/template/.storybook/addons.js @@ -0,0 +1,2 @@ +import '@kadira/storybook-addon-actions/register'; +import '@kadira/storybook-addon-links/register'; diff --git a/packages/getstorybook/generators/REACT/template/.storybook/addons.js b/packages/getstorybook/generators/REACT/template/.storybook/addons.js new file mode 100644 index 000000000000..e8590efcf2fd --- /dev/null +++ b/packages/getstorybook/generators/REACT/template/.storybook/addons.js @@ -0,0 +1,2 @@ +import '@kadira/storybook-addon-actions/register'; +import '@kadira/storybook-addon-links/register'; diff --git a/packages/getstorybook/generators/REACT/template/stories/index.js b/packages/getstorybook/generators/REACT/template/stories/index.js index ee5770241712..aab92a8a0eca 100644 --- a/packages/getstorybook/generators/REACT/template/stories/index.js +++ b/packages/getstorybook/generators/REACT/template/stories/index.js @@ -1,5 +1,7 @@ import React from 'react'; -import { storiesOf, action, linkTo } from '@kadira/storybook'; +import { storiesOf } from '@kadira/storybook'; +import { action } from '@kadira/storybook-addon-actions'; +import { linkTo } from '@kadira/storybook-addon-links'; import Button from './Button'; import Welcome from './Welcome'; diff --git a/packages/getstorybook/generators/REACT_NATIVE/template/storybook/addons.js b/packages/getstorybook/generators/REACT_NATIVE/template/storybook/addons.js index f4d48bb0fb93..e8590efcf2fd 100644 --- a/packages/getstorybook/generators/REACT_NATIVE/template/storybook/addons.js +++ b/packages/getstorybook/generators/REACT_NATIVE/template/storybook/addons.js @@ -1 +1,2 @@ -import '@kadira/react-native-storybook/addons'; +import '@kadira/storybook-addon-actions/register'; +import '@kadira/storybook-addon-links/register'; diff --git a/packages/getstorybook/generators/REACT_NATIVE/template/storybook/stories/index.js b/packages/getstorybook/generators/REACT_NATIVE/template/storybook/stories/index.js index c7da1906faee..865126b603fa 100644 --- a/packages/getstorybook/generators/REACT_NATIVE/template/storybook/stories/index.js +++ b/packages/getstorybook/generators/REACT_NATIVE/template/storybook/stories/index.js @@ -1,6 +1,8 @@ import React from 'react'; import { Text } from 'react-native'; -import { storiesOf, action, linkTo } from '@kadira/react-native-storybook'; +import { storiesOf } from '@kadira/react-native-storybook'; +import { action } from '@kadira/storybook-addon-actions'; +import { linkTo } from '@kadira/storybook-addon-links'; import Button from './Button'; import CenterView from './CenterView'; diff --git a/packages/getstorybook/generators/REACT_SCRIPTS/template/.storybook/addons.js b/packages/getstorybook/generators/REACT_SCRIPTS/template/.storybook/addons.js new file mode 100644 index 000000000000..e8590efcf2fd --- /dev/null +++ b/packages/getstorybook/generators/REACT_SCRIPTS/template/.storybook/addons.js @@ -0,0 +1,2 @@ +import '@kadira/storybook-addon-actions/register'; +import '@kadira/storybook-addon-links/register'; diff --git a/packages/getstorybook/generators/REACT_SCRIPTS/template/src/stories/index.js b/packages/getstorybook/generators/REACT_SCRIPTS/template/src/stories/index.js index ee5770241712..aab92a8a0eca 100644 --- a/packages/getstorybook/generators/REACT_SCRIPTS/template/src/stories/index.js +++ b/packages/getstorybook/generators/REACT_SCRIPTS/template/src/stories/index.js @@ -1,5 +1,7 @@ import React from 'react'; -import { storiesOf, action, linkTo } from '@kadira/storybook'; +import { storiesOf } from '@kadira/storybook'; +import { action } from '@kadira/storybook-addon-actions'; +import { linkTo } from '@kadira/storybook-addon-links'; import Button from './Button'; import Welcome from './Welcome'; diff --git a/packages/react-native-storybook/docs/manual-setup.md b/packages/react-native-storybook/docs/manual-setup.md index 60c260276986..9bd0ab8529da 100644 --- a/packages/react-native-storybook/docs/manual-setup.md +++ b/packages/react-native-storybook/docs/manual-setup.md @@ -25,7 +25,8 @@ AppRegistry.registerComponent('MyApplicationName', () => StorybookUI); Create a file named `addons.js` file in `storybook` directory to use default set of addons. ``` -import '@kadira/react-native-storybook/addons'; +import '@kadira/storybook-addon-actions'; +import '@kadira/storybook-addon-links'; ``` Then write your first story in the `stories` directory like this: diff --git a/packages/react-native-storybook/package.json b/packages/react-native-storybook/package.json index cead9b916924..98c71e36d752 100644 --- a/packages/react-native-storybook/package.json +++ b/packages/react-native-storybook/package.json @@ -1,75 +1,76 @@ -{ - "name": "@kadira/react-native-storybook", - "version": "2.3.0", - "description": "A better way to develop React Native Components for your app", - "main": "dist/index.js", - "bin": { - "storybook": "dist/bin/storybook.js" - }, - "scripts": { - "prepublish": "node ../../scripts/prepublish.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/kadirahq/react-native-storybook.git" - }, - "keywords": [ - "react", - "react-native", - "storybook" - ], - "license": "MIT", - "bugs": { - "url": "https://github.com/kadirahq/react-native-storybook/issues" - }, - "homepage": "https://github.com/kadirahq/react-native-storybook#readme", - "peerDependencies": { - "react": "*", - "react-native": "0.27.0 - 0.43.x" - }, - "devDependencies": { - "babel-cli": "^6.24.1", - "react": "^15.5.4", - "react-dom": "^15.5.4", - "react-native": "^0.43.3" - }, - "dependencies": { - "@kadira/storybook-addon-actions": "*", - "@kadira/storybook-addon-links": "*", - "@kadira/storybook-addons": "*", - "@kadira/storybook-channel-websocket": "*", - "@kadira/storybook-ui": "*", - "autoprefixer": "^7.0.1", - "babel-core": "^6.24.1", - "babel-loader": "^7.0.0", - "babel-plugin-syntax-async-functions": "^6.13.0", - "babel-plugin-syntax-trailing-function-commas": "^6.22.0", - "babel-plugin-transform-class-properties": "^6.24.1", - "babel-plugin-transform-object-rest-spread": "^6.23.0", - "babel-plugin-transform-react-constant-elements": "^6.23.0", - "babel-plugin-transform-regenerator": "^6.24.1", - "babel-plugin-transform-runtime": "^6.23.0", - "babel-polyfill": "^6.23.0", - "babel-preset-es2015": "^6.24.1", - "babel-preset-es2016": "^6.24.1", - "babel-preset-react": "^6.24.1", - "babel-preset-stage-0": "^6.24.1", - "babel-runtime": "^6.23.0", - "case-sensitive-paths-webpack-plugin": "^2.0.0", - "commander": "^2.9.0", - "css-loader": "^0.28.0", - "events": "^1.1.1", - "express": "^4.15.2", - "file-loader": "^0.11.1", - "json-loader": "^0.5.4", - "json5": "^0.5.1", - "postcss-loader": "^2.0.3", - "shelljs": "^0.7.7", - "style-loader": "^0.17.0", - "url-loader": "^0.5.8", - "uuid": "^3.0.1", - "webpack": "^2.4.1", - "webpack-dev-middleware": "^1.10.1", - "webpack-hot-middleware": "^2.18.0" - } -} +{ + "name": "@kadira/react-native-storybook", + "version": "2.3.0", + "description": "A better way to develop React Native Components for your app", + "main": "dist/index.js", + "bin": { + "storybook": "dist/bin/storybook.js" + }, + "scripts": { + "prepublish": "node ../../scripts/prepublish.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/kadirahq/react-native-storybook.git" + }, + "keywords": [ + "react", + "react-native", + "storybook" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/kadirahq/react-native-storybook/issues" + }, + "homepage": "https://github.com/kadirahq/react-native-storybook#readme", + "peerDependencies": { + "react": "*", + "react-native": "0.27.0 - 0.43.x" + }, + "devDependencies": { + "babel-cli": "^6.24.1", + "react": "^15.5.4", + "react-dom": "^15.5.4", + "react-native": "^0.43.3" + }, + "dependencies": { + "@kadira/storybook-addon-actions": "*", + "@kadira/storybook-addon-links": "*", + "@kadira/storybook-addons": "*", + "@kadira/storybook-channel-websocket": "*", + "@kadira/storybook-ui": "*", + "autoprefixer": "^7.0.1", + "babel-core": "^6.24.1", + "babel-loader": "^7.0.0", + "babel-plugin-syntax-async-functions": "^6.13.0", + "babel-plugin-syntax-trailing-function-commas": "^6.22.0", + "babel-plugin-transform-class-properties": "^6.24.1", + "babel-plugin-transform-object-rest-spread": "^6.23.0", + "babel-plugin-transform-react-constant-elements": "^6.23.0", + "babel-plugin-transform-regenerator": "^6.24.1", + "babel-plugin-transform-runtime": "^6.23.0", + "babel-polyfill": "^6.23.0", + "babel-preset-es2015": "^6.24.1", + "babel-preset-es2016": "^6.24.1", + "babel-preset-react": "^6.24.1", + "babel-preset-stage-0": "^6.24.1", + "babel-runtime": "^6.23.0", + "case-sensitive-paths-webpack-plugin": "^2.0.0", + "commander": "^2.9.0", + "css-loader": "^0.28.0", + "events": "^1.1.1", + "express": "^4.15.2", + "file-loader": "^0.11.1", + "json-loader": "^0.5.4", + "json5": "^0.5.1", + "postcss-loader": "^2.0.3", + "shelljs": "^0.7.7", + "style-loader": "^0.17.0", + "url-loader": "^0.5.8", + "util-deprecate": "^1.0.2", + "uuid": "^3.0.1", + "webpack": "^2.4.1", + "webpack-dev-middleware": "^1.10.1", + "webpack-hot-middleware": "^2.18.0" + } +} diff --git a/packages/react-native-storybook/src/index.js b/packages/react-native-storybook/src/index.js index efb50a0034c0..12abff588c14 100644 --- a/packages/react-native-storybook/src/index.js +++ b/packages/react-native-storybook/src/index.js @@ -1,3 +1,4 @@ +import deprecate from 'util-deprecate'; import Preview from './preview'; const preview = new Preview(); @@ -10,5 +11,15 @@ export const getStorybook = preview.getStorybook.bind(preview); export const getStorybookUI = preview.getStorybookUI.bind(preview); // NOTE export these to keep backwards compatibility -export { action } from '@kadira/storybook-addon-actions'; -export { linkTo } from '@kadira/storybook-addon-links'; +import { action as _action } from '@kadira/storybook-addon-actions'; +import { linkTo as _linkTo } from '@kadira/storybook-addon-links'; + +export const action = deprecate( + _action, + '@kadira/storybook action is deprecated. See: https://github.com/storybooks/storybook/tree/master/packages/addon-actions', +); + +export const linkTo = deprecate( + _linkTo, + '@kadira/storybook linkTo is deprecated. See: https://github.com/storybooks/storybook/tree/master/packages/addon-links', +); diff --git a/packages/react-native-storybook/src/server/addons.js b/packages/react-native-storybook/src/server/addons.js index e8590efcf2fd..e05a3e134a71 100644 --- a/packages/react-native-storybook/src/server/addons.js +++ b/packages/react-native-storybook/src/server/addons.js @@ -1,2 +1,8 @@ +import deprecate from 'util-deprecate'; import '@kadira/storybook-addon-actions/register'; import '@kadira/storybook-addon-links/register'; + +deprecate( + () => {}, + '@kadira/react-native-storybook/addons is deprecated. See https://storybooks.js.org/docs/react-storybook/addons/using-addons/', +)(); diff --git a/packages/react-storybook/demo/.storybook/addons.js b/packages/react-storybook/demo/.storybook/addons.js new file mode 100644 index 000000000000..e8590efcf2fd --- /dev/null +++ b/packages/react-storybook/demo/.storybook/addons.js @@ -0,0 +1,2 @@ +import '@kadira/storybook-addon-actions/register'; +import '@kadira/storybook-addon-links/register'; diff --git a/packages/react-storybook/demo/package.json b/packages/react-storybook/demo/package.json index 0a05f8120ccb..6f5f6fc054a8 100644 --- a/packages/react-storybook/demo/package.json +++ b/packages/react-storybook/demo/package.json @@ -4,7 +4,10 @@ "private": true, "devDependencies": { "react-scripts": "0.9.5", - "@kadira/storybook": "file:../" + "@kadira/storybook": "file:../", + "@kadira/storybook-addon-actions": "file:../../addon-actions", + "@kadira/storybook-addon-links": "file:../../addon-links", + "@kadira/storybook-addons": "file:../../addons" }, "dependencies": { "prop-types": "^15.5.8", diff --git a/packages/react-storybook/demo/src/stories/index.js b/packages/react-storybook/demo/src/stories/index.js index ee5770241712..aab92a8a0eca 100644 --- a/packages/react-storybook/demo/src/stories/index.js +++ b/packages/react-storybook/demo/src/stories/index.js @@ -1,5 +1,7 @@ import React from 'react'; -import { storiesOf, action, linkTo } from '@kadira/storybook'; +import { storiesOf } from '@kadira/storybook'; +import { action } from '@kadira/storybook-addon-actions'; +import { linkTo } from '@kadira/storybook-addon-links'; import Button from './Button'; import Welcome from './Welcome'; diff --git a/packages/react-storybook/package.json b/packages/react-storybook/package.json index e8d26ff96148..1c0e108c2e83 100644 --- a/packages/react-storybook/package.json +++ b/packages/react-storybook/package.json @@ -58,6 +58,7 @@ "shelljs": "^0.7.7", "style-loader": "^0.17.0", "url-loader": "^0.5.8", + "util-deprecate": "^1.0.2", "uuid": "^3.0.1", "webpack": "^2.4.1", "webpack-dev-middleware": "^1.10.1", diff --git a/packages/react-storybook/src/client/index.js b/packages/react-storybook/src/client/index.js index 3bcdb23705fd..aa73b7ad9364 100644 --- a/packages/react-storybook/src/client/index.js +++ b/packages/react-storybook/src/client/index.js @@ -1,3 +1,4 @@ +import deprecate from 'util-deprecate'; import * as previewApi from './preview'; export const storiesOf = previewApi.storiesOf; @@ -7,5 +8,15 @@ export const configure = previewApi.configure; export const getStorybook = previewApi.getStorybook; // NOTE export these to keep backwards compatibility -export { action } from '@kadira/storybook-addon-actions'; -export { linkTo } from '@kadira/storybook-addon-links'; +import { action as _action } from '@kadira/storybook-addon-actions'; +import { linkTo as _linkTo } from '@kadira/storybook-addon-links'; + +export const action = deprecate( + _action, + '@kadira/storybook action is deprecated. See: https://github.com/storybooks/storybook/tree/master/packages/addon-actions', +); + +export const linkTo = deprecate( + _linkTo, + '@kadira/storybook linkTo is deprecated. See: https://github.com/storybooks/storybook/tree/master/packages/addon-links', +); diff --git a/packages/react-storybook/src/server/addons.js b/packages/react-storybook/src/server/addons.js index e8590efcf2fd..40fd2193b246 100644 --- a/packages/react-storybook/src/server/addons.js +++ b/packages/react-storybook/src/server/addons.js @@ -1,2 +1,8 @@ +import deprecate from 'util-deprecate'; import '@kadira/storybook-addon-actions/register'; import '@kadira/storybook-addon-links/register'; + +deprecate( + () => {}, + '@kadira/storybook/addons is deprecated. See https://storybooks.js.org/docs/react-storybook/addons/using-addons/', +)(); diff --git a/packages/storyshots/package.json b/packages/storyshots/package.json index a175867301f7..eff17c366204 100644 --- a/packages/storyshots/package.json +++ b/packages/storyshots/package.json @@ -23,6 +23,8 @@ }, "dependencies": { "@kadira/storybook": "*", + "@kadira/storybook-addon-actions": "*", + "@kadira/storybook-addon-links": "*", "@kadira/storybook-addons": "*", "@kadira/storybook-channel": "*", "babel-runtime": "^6.23.0", diff --git a/packages/storyshots/stories/required_with_context/Button.stories.js b/packages/storyshots/stories/required_with_context/Button.stories.js index ba6a7a3d8d25..4298130bbb95 100644 --- a/packages/storyshots/stories/required_with_context/Button.stories.js +++ b/packages/storyshots/stories/required_with_context/Button.stories.js @@ -1,5 +1,7 @@ import React from 'react'; -import { storiesOf, action, linkTo } from '@kadira/storybook'; +import { storiesOf } from '@kadira/storybook'; +import { action } from '@kadira/storybook-addon-actions'; +import { linkTo } from '@kadira/storybook-addon-links'; import Button from './Button'; import Welcome from './Welcome'; diff --git a/packages/storyshots/stories/required_with_context/Welcome.stories.js b/packages/storyshots/stories/required_with_context/Welcome.stories.js index 4f1c4e1c31f0..313b81e27013 100644 --- a/packages/storyshots/stories/required_with_context/Welcome.stories.js +++ b/packages/storyshots/stories/required_with_context/Welcome.stories.js @@ -1,5 +1,6 @@ import React from 'react'; -import { storiesOf, linkTo } from '@kadira/storybook'; +import { storiesOf } from '@kadira/storybook'; +import { linkTo } from '@kadira/storybook-addon-links'; import Welcome from './Welcome'; storiesOf('Welcome', module).add('to Storybook', () => ); From 797f38edd7b0cbacbb0102e4050ad6e0d570a51f Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Sat, 13 May 2017 10:12:30 +1000 Subject: [PATCH 2/3] Respect linting rules --- packages/react-native-storybook/src/index.js | 8 ++++---- packages/react-storybook/src/client/index.js | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/react-native-storybook/src/index.js b/packages/react-native-storybook/src/index.js index 12abff588c14..2d9f9eeb61a6 100644 --- a/packages/react-native-storybook/src/index.js +++ b/packages/react-native-storybook/src/index.js @@ -11,15 +11,15 @@ export const getStorybook = preview.getStorybook.bind(preview); export const getStorybookUI = preview.getStorybookUI.bind(preview); // NOTE export these to keep backwards compatibility -import { action as _action } from '@kadira/storybook-addon-actions'; -import { linkTo as _linkTo } from '@kadira/storybook-addon-links'; +import { action as deprecatedAction } from '@kadira/storybook-addon-actions'; +import { linkTo as deprecatedLinkTo } from '@kadira/storybook-addon-links'; export const action = deprecate( - _action, + deprecatedAction, '@kadira/storybook action is deprecated. See: https://github.com/storybooks/storybook/tree/master/packages/addon-actions', ); export const linkTo = deprecate( - _linkTo, + deprecatedLinkTo, '@kadira/storybook linkTo is deprecated. See: https://github.com/storybooks/storybook/tree/master/packages/addon-links', ); diff --git a/packages/react-storybook/src/client/index.js b/packages/react-storybook/src/client/index.js index aa73b7ad9364..1fd0c734a257 100644 --- a/packages/react-storybook/src/client/index.js +++ b/packages/react-storybook/src/client/index.js @@ -1,4 +1,4 @@ -import deprecate from 'util-deprecate'; +deprecatedimport deprecate from 'util-deprecate'; import * as previewApi from './preview'; export const storiesOf = previewApi.storiesOf; @@ -8,15 +8,15 @@ export const configure = previewApi.configure; export const getStorybook = previewApi.getStorybook; // NOTE export these to keep backwards compatibility -import { action as _action } from '@kadira/storybook-addon-actions'; -import { linkTo as _linkTo } from '@kadira/storybook-addon-links'; +import { action as deprecatedAction } from '@kadira/storybook-addon-actions'; +import { linkTo as deprecatedLinkTo } from '@kadira/storybook-addon-links'; export const action = deprecate( - _action, + deprecatedAction, '@kadira/storybook action is deprecated. See: https://github.com/storybooks/storybook/tree/master/packages/addon-actions', ); export const linkTo = deprecate( - _linkTo, + deprecatedLinkTo, '@kadira/storybook linkTo is deprecated. See: https://github.com/storybooks/storybook/tree/master/packages/addon-links', ); From 32653519997aed2b085cf82a231cda6beba5beda Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Sat, 13 May 2017 19:15:19 +1000 Subject: [PATCH 3/3] Fix typo --- packages/react-storybook/src/client/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-storybook/src/client/index.js b/packages/react-storybook/src/client/index.js index 1fd0c734a257..0e681f81b0eb 100644 --- a/packages/react-storybook/src/client/index.js +++ b/packages/react-storybook/src/client/index.js @@ -1,4 +1,4 @@ -deprecatedimport deprecate from 'util-deprecate'; +import deprecate from 'util-deprecate'; import * as previewApi from './preview'; export const storiesOf = previewApi.storiesOf;