Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deprecation warnings when addons are required via main package #1025

Merged
merged 3 commits into from
May 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/cra-storybook/.storybook/addons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '@kadira/storybook-addon-actions/register';
import '@kadira/storybook-addon-links/register';
3 changes: 3 additions & 0 deletions examples/cra-storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 3 additions & 1 deletion examples/cra-storybook/src/stories/index.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 2 additions & 0 deletions examples/test-cra/.storybook/addons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '@kadira/storybook-addon-actions/register';
import '@kadira/storybook-addon-links/register';
1 change: 1 addition & 0 deletions examples/test-cra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion examples/test-cra/src/stories/index.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
3 changes: 0 additions & 3 deletions packages/addon-actions/.storybook/addons.js
Original file line number Diff line number Diff line change
@@ -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';
3 changes: 0 additions & 3 deletions packages/addon-comments/.storybook/addons.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/addon-info/.storybook/addons.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import '@kadira/storybook/addons';
import '@kadira/storybook-addon-actions/register';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this missing addon-links?
Or is this on purpose?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on purpose. links are not used in this example.

import 'react-storybook-addon-backgrounds/register';
3 changes: 2 additions & 1 deletion packages/addon-info/example/story.js
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
1 change: 0 additions & 1 deletion packages/addon-knobs/.storybook/addons.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
import '../src/register';
import '@kadira/storybook/addons'
3 changes: 0 additions & 3 deletions packages/addon-knobs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
```

Expand Down
3 changes: 0 additions & 3 deletions packages/addon-links/.storybook/addons.js
Original file line number Diff line number Diff line change
@@ -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';
3 changes: 2 additions & 1 deletion packages/addon-links/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => (
Expand Down
1 change: 0 additions & 1 deletion packages/addon-notes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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';
```

Expand Down
3 changes: 0 additions & 3 deletions packages/addon-options/.storybook/addons.js
Original file line number Diff line number Diff line change
@@ -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';
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '@kadira/storybook-addon-actions/register';
import '@kadira/storybook-addon-links/register';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '@kadira/storybook-addon-actions/register';
import '@kadira/storybook-addon-links/register';
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import '@kadira/react-native-storybook/addons';
import '@kadira/storybook-addon-actions/register';
import '@kadira/storybook-addon-links/register';
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '@kadira/storybook-addon-actions/register';
import '@kadira/storybook-addon-links/register';
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
3 changes: 2 additions & 1 deletion packages/react-native-storybook/docs/manual-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
151 changes: 76 additions & 75 deletions packages/react-native-storybook/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
15 changes: 13 additions & 2 deletions packages/react-native-storybook/src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import deprecate from 'util-deprecate';
import Preview from './preview';

const preview = new Preview();
Expand All @@ -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 deprecatedAction } from '@kadira/storybook-addon-actions';
import { linkTo as deprecatedLinkTo } from '@kadira/storybook-addon-links';

export const action = deprecate(
deprecatedAction,
'@kadira/storybook action is deprecated. See: https://github.com/storybooks/storybook/tree/master/packages/addon-actions',
);

export const linkTo = deprecate(
deprecatedLinkTo,
'@kadira/storybook linkTo is deprecated. See: https://github.com/storybooks/storybook/tree/master/packages/addon-links',
);
6 changes: 6 additions & 0 deletions packages/react-native-storybook/src/server/addons.js
Original file line number Diff line number Diff line change
@@ -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/',
)();
2 changes: 2 additions & 0 deletions packages/react-storybook/demo/.storybook/addons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import '@kadira/storybook-addon-actions/register';
import '@kadira/storybook-addon-links/register';
5 changes: 4 additions & 1 deletion packages/react-storybook/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion packages/react-storybook/demo/src/stories/index.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
1 change: 1 addition & 0 deletions packages/react-storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading