diff --git a/.eslintrc.js b/.eslintrc.js index 383b296fae27..66def4704556 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -5,13 +5,13 @@ const ignore = 0; module.exports = { root: true, extends: [ - 'eslint-config-airbnb', + 'airbnb', 'plugin:jest/recommended', 'plugin:import/react-native', 'prettier', 'prettier/react', ], - plugins: ['prettier', 'jest', 'react', 'json'], + plugins: ['prettier', 'jest', 'import', 'react', 'jsx-a11y', 'json'], parser: 'babel-eslint', parserOptions: { sourceType: 'module', diff --git a/ADDONS_SUPPORT.md b/ADDONS_SUPPORT.md index 4ef0304a975e..98f0046ade3e 100644 --- a/ADDONS_SUPPORT.md +++ b/ADDONS_SUPPORT.md @@ -11,7 +11,7 @@ |[info](addons/info) |+| | | | | |[jest](addons/jest) |+| | | | | |[knobs](addons/knobs) |+|+|+|+|+| -|[links](addons/links) |+|+|+|+| | +|[links](addons/links) |+|+|+|+|+| |[notes](addons/notes) |+| |+|+|+| |[options](addons/options) |+|+|+|+|+| |[storyshots](addons/storyshots) |+|+|+|+| | diff --git a/CHANGELOG.md b/CHANGELOG.md index 6472efbf2df5..0f6f5992383c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -208,7 +208,7 @@ - Addon Storysource improvements [#3040](https://github.com/storybooks/storybook/pull/3040) - #3029 use @storybook/podda to fix npm engine version in podda [#3033](https://github.com/storybooks/storybook/pull/3033) - Add moduleMetdata decorator for supplying common Angular metadata [#2959](https://github.com/storybooks/storybook/pull/2959) -- [Addon Storysource] Add auto scrolling to the selected story [#3025](https://github.com/storybooks/storybook/pull/3025) +- `Addon Storysource` Add auto scrolling to the selected story [#3025](https://github.com/storybooks/storybook/pull/3025) - add GitHub flavored markdown notes [#2946](https://github.com/storybooks/storybook/pull/2946) - Added beforeScreenshot config option to addons/storyshots, to allow testing of components with mounting animations [#2972](https://github.com/storybooks/storybook/pull/2972) - Enable groupId option for knobs to be organized into sub panels. [#2661](https://github.com/storybooks/storybook/pull/2661) diff --git a/README.md b/README.md index f8b3640dabe4..e9eb1544ac6d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Build Status on CircleCI](https://circleci.com/gh/storybooks/storybook.svg?style=shield)](https://circleci.com/gh/storybooks/storybook) [![CodeFactor](https://www.codefactor.io/repository/github/storybooks/storybook/badge)](https://www.codefactor.io/repository/github/storybooks/storybook) [![Known Vulnerabilities](https://snyk.io/test/github/storybooks/storybook/8f36abfd6697e58cd76df3526b52e4b9dc894847/badge.svg)](https://snyk.io/test/github/storybooks/storybook/8f36abfd6697e58cd76df3526b52e4b9dc894847) -[![BCH compliance](https://bettercodehub.com/edge/badge/storybooks/storybook)](https://bettercodehub.com/results/storybooks/storybook) [![codecov](https://codecov.io/gh/storybooks/storybook/branch/master/graph/badge.svg)](https://codecov.io/gh/storybooks/storybook) +[![BCH compliance](https://bettercodehub.com/edge/badge/storybooks/storybook)](https://bettercodehub.com/results/storybooks/storybook) [![codecov](https://codecov.io/gh/storybooks/storybook/branch/master/graph/badge.svg)](https://codecov.io/gh/storybooks/storybook) [![Storybook Slack](https://now-examples-slackin-rrirkqohko.now.sh/badge.svg)](https://now-examples-slackin-rrirkqohko.now.sh/) [![Backers on Open Collective](https://opencollective.com/storybook/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/storybook/sponsors/badge.svg)](#sponsors) @@ -80,15 +80,21 @@ For additional help, join us [in our Slack](https://now-examples-slackin-rrirkqo ### Addons -- [storyshots](addons/storyshots) - Easy snapshot testing for storybook -- [actions](addons/actions/) - Log actions as users interact with components in storybook -- [links](addons/links/) - Create links between stories -- [comments](addons/comments/) - Comment on storybook stories +- [a11y](addons/a11y/) - Test components for user accessibility in Storybook +- [actions](addons/actions/) - Log actions as users interact with components in the Storybook UI +- [background](addons/background/) - Let users choose backgrounds in the Storybook UI +- [centered](addons/centered/) - Center the alignment of your components within the Storybook UI +- [events](addons/events/) - Interactively fire events to components that respond to EventEmitter - [graphql](addons/graphql/) - Query a GraphQL server within Storybook stories - [info](addons/info/) - Annotate stories with extra component usage information +- [jest](addons/jest/) - View the results of components' unit tests in Storybook - [knobs](addons/knobs/) - Interactively edit component prop data in the Storybook UI -- [notes](addons/notes/) - Annotate storybook stories with notes -- [options](addons/options/) - Customize the storybook UI in code +- [links](addons/links/) - Create links between stories +- [notes](addons/notes/) - Annotate Storybook stories with notes +- [options](addons/options/) - Customize the Storybook UI in code +- [storyshots](addons/storyshots/) - Easy snapshot testing for components in Storybook +- [storysource](addons/storysource/) - View the code of your stories within the Storybook UI +- [viewport](addons/viewport/) - Change display sizes and layouts for responsive components using Storybook See [Addon / Framework Support Table](ADDONS_SUPPORT.md) diff --git a/addons/a11y/package.json b/addons/a11y/package.json index e80eb8a4b0a2..9f1a5b4bb36f 100644 --- a/addons/a11y/package.json +++ b/addons/a11y/package.json @@ -27,8 +27,10 @@ "dependencies": { "@storybook/components": "^3.4.0-alpha.9", "axe-core": "^2.6.1", + "babel-runtime": "^6.26.0", + "glamor": "^2.20.40", "glamorous": "^4.11.6", - "prop-types": "^15.6.0" + "prop-types": "^15.6.1" }, "devDependencies": { "@storybook/react": "^3.4.0-alpha.9", diff --git a/addons/actions/package.json b/addons/actions/package.json index 61d7ae9a9fe7..ffb4c61f69a2 100644 --- a/addons/actions/package.json +++ b/addons/actions/package.json @@ -21,11 +21,13 @@ }, "dependencies": { "@storybook/components": "^3.4.0-alpha.9", + "babel-runtime": "^6.26.0", "deep-equal": "^1.0.1", + "glamor": "^2.20.40", "glamorous": "^4.11.6", "global": "^4.3.2", "make-error": "^1.3.4", - "prop-types": "^15.6.0", + "prop-types": "^15.6.1", "react-inspector": "^2.2.2", "uuid": "^3.2.1" }, diff --git a/addons/background/README.md b/addons/background/README.md index 6137b9ac0a46..0dae593a512e 100644 --- a/addons/background/README.md +++ b/addons/background/README.md @@ -3,13 +3,13 @@ [![Build Status on CircleCI](https://circleci.com/gh/storybooks/storybook.svg?style=shield)](https://circleci.com/gh/storybooks/storybook) [![CodeFactor](https://www.codefactor.io/repository/github/storybooks/storybook/badge)](https://www.codefactor.io/repository/github/storybooks/storybook) [![Known Vulnerabilities](https://snyk.io/test/github/storybooks/storybook/8f36abfd6697e58cd76df3526b52e4b9dc894847/badge.svg)](https://snyk.io/test/github/storybooks/storybook/8f36abfd6697e58cd76df3526b52e4b9dc894847) -[![BCH compliance](https://bettercodehub.com/edge/badge/storybooks/storybook)](https://bettercodehub.com/results/storybooks/storybook) [![codecov](https://codecov.io/gh/storybooks/storybook/branch/master/graph/badge.svg)](https://codecov.io/gh/storybooks/storybook) +[![BCH compliance](https://bettercodehub.com/edge/badge/storybooks/storybook)](https://bettercodehub.com/results/storybooks/storybook) [![codecov](https://codecov.io/gh/storybooks/storybook/branch/master/graph/badge.svg)](https://codecov.io/gh/storybooks/storybook) [![Storybook Slack](https://now-examples-slackin-rrirkqohko.now.sh/badge.svg)](https://now-examples-slackin-rrirkqohko.now.sh/) [![Backers on Open Collective](https://opencollective.com/storybook/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/storybook/sponsors/badge.svg)](#sponsors) * * * -Storybook Centered Decorator can be used to center components inside the preview in [Storybook](https://storybook.js.org). +Storybook Background Addon can be used to change background colors inside the preview in [Storybook](https://storybook.js.org). [Framework Support](https://github.com/storybooks/storybook/blob/master/ADDONS_SUPPORT.md) @@ -18,7 +18,7 @@ Storybook Centered Decorator can be used to center components inside the preview ## Installation ```sh -npm i --save @storybook/addon-backgrounds +npm i -D @storybook/addon-backgrounds ``` ## Configuration diff --git a/addons/background/package.json b/addons/background/package.json index 795ebfee8f3f..24643928a4d7 100644 --- a/addons/background/package.json +++ b/addons/background/package.json @@ -24,8 +24,9 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { + "babel-runtime": "^6.26.0", "global": "^4.3.2", - "prop-types": "^15.6.0" + "prop-types": "^15.6.1" }, "peerDependencies": { "@storybook/addons": "^3.3.0", diff --git a/addons/centered/package.json b/addons/centered/package.json index aa1d30c338f2..b76680ad85f9 100644 --- a/addons/centered/package.json +++ b/addons/centered/package.json @@ -10,6 +10,7 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { + "babel-runtime": "^6.26.0", "global": "^4.3.2" }, "devDependencies": { diff --git a/addons/events/docs/.DS_Store b/addons/events/docs/.DS_Store deleted file mode 100644 index 817e5e65edf1..000000000000 Binary files a/addons/events/docs/.DS_Store and /dev/null differ diff --git a/addons/events/package.json b/addons/events/package.json index 0ef65dd6ab5e..44ff92d2c024 100644 --- a/addons/events/package.json +++ b/addons/events/package.json @@ -23,9 +23,8 @@ "dependencies": { "babel-runtime": "^6.26.0", "format-json": "^1.0.3", - "prop-types": "^15.6.0", - "react-textarea-autosize": "^5.2.1", - "uuid": "^3.2.1" + "prop-types": "^15.6.1", + "react-textarea-autosize": "^5.2.1" }, "peerDependencies": { "@storybook/addons": "^3.3.0", diff --git a/addons/events/src/components/Panel.js b/addons/events/src/components/Panel.js index a243893d2ae5..dd4c8beff30c 100644 --- a/addons/events/src/components/Panel.js +++ b/addons/events/src/components/Panel.js @@ -66,7 +66,7 @@ export default class Events extends Component { const { events } = this.state; return (
- {events.map(event => )} + {events.map(event => )}
); } diff --git a/addons/graphql/package.json b/addons/graphql/package.json index 1b71737b69e9..e1f460517c64 100644 --- a/addons/graphql/package.json +++ b/addons/graphql/package.json @@ -22,10 +22,11 @@ "storybook": "start-storybook -p 9001" }, "dependencies": { + "babel-runtime": "^6.26.0", "global": "^4.3.2", "graphiql": "^0.11.11", "graphql": "^0.13.1", - "prop-types": "^15.6.0" + "prop-types": "^15.6.1" }, "devDependencies": { "@storybook/react": "^3.4.0-alpha.9" diff --git a/addons/info/package.json b/addons/info/package.json index 9982a2c0265b..fca2d2e43b0b 100644 --- a/addons/info/package.json +++ b/addons/info/package.json @@ -18,11 +18,12 @@ "@storybook/client-logger": "^3.4.0-alpha.9", "@storybook/components": "^3.4.0-alpha.9", "babel-runtime": "^6.26.0", + "glamor": "^2.20.40", "glamorous": "^4.11.6", "global": "^4.3.2", "marksy": "^6.0.3", "nested-object-assign": "^1.0.1", - "prop-types": "^15.6.0", + "prop-types": "^15.6.1", "react-addons-create-fragment": "^15.5.3", "util-deprecate": "^1.0.2" }, diff --git a/addons/info/src/__snapshots__/index.test.js.snap b/addons/info/src/__snapshots__/index.test.js.snap index d65df80a9254..baccb582c91f 100644 --- a/addons/info/src/__snapshots__/index.test.js.snap +++ b/addons/info/src/__snapshots__/index.test.js.snap @@ -158,9 +158,7 @@ containing **bold**, *cursive* text, \`code\` and [a link](https://github.com)" >

- function func(x) { - return x + 1; - } + function func(x) {return x + 1;}

[object Object] diff --git a/addons/jest/package.json b/addons/jest/package.json index e99f8cc759a3..c79ef5d10299 100644 --- a/addons/jest/package.json +++ b/addons/jest/package.json @@ -26,10 +26,11 @@ }, "dependencies": { "@storybook/components": "^3.4.0-alpha.9", + "babel-runtime": "^6.26.0", "glamor": "^2.20.40", "glamorous": "^4.11.6", "global": "^4.3.2", - "prop-types": "^15.6.0" + "prop-types": "^15.6.1" }, "peerDependencies": { "@storybook/addons": "^3.3.0", diff --git a/addons/knobs/package.json b/addons/knobs/package.json index c01ecde33529..ef1ee44bd0e0 100644 --- a/addons/knobs/package.json +++ b/addons/knobs/package.json @@ -22,7 +22,7 @@ "insert-css": "^2.0.0", "lodash.debounce": "^4.0.8", "moment": "^2.20.1", - "prop-types": "^15.6.0", + "prop-types": "^15.6.1", "react-color": "^2.11.4", "react-datetime": "^2.14.0", "react-textarea-autosize": "^5.2.1", diff --git a/addons/links/package.json b/addons/links/package.json index 0b190eb1fab3..29bfb2e3b06b 100644 --- a/addons/links/package.json +++ b/addons/links/package.json @@ -23,15 +23,15 @@ }, "dependencies": { "@storybook/components": "^3.4.0-alpha.9", + "babel-runtime": "^6.26.0", "global": "^4.3.2", - "prop-types": "^15.5.10" + "prop-types": "^15.6.1" }, "devDependencies": { "@storybook/react": "^3.4.0-alpha.9", "enzyme": "^3.3.0", "react": "^16.1.0", - "react-dom": "^16.1.0", - "shelljs": "^0.8.1" + "react-dom": "^16.1.0" }, "peerDependencies": { "@storybook/addons": "^3.3.0", diff --git a/addons/notes/package.json b/addons/notes/package.json index 5b17bd4ec7f1..a33ca6c5ec93 100644 --- a/addons/notes/package.json +++ b/addons/notes/package.json @@ -21,8 +21,8 @@ }, "dependencies": { "babel-runtime": "^6.26.0", - "marked": "^0.3.16", - "prop-types": "^15.6.0", + "marked": "^0.3.17", + "prop-types": "^15.6.1", "util-deprecate": "^1.0.2" }, "devDependencies": { diff --git a/addons/options/package.json b/addons/options/package.json index 56876fccaf27..d7063ca82d01 100644 --- a/addons/options/package.json +++ b/addons/options/package.json @@ -19,6 +19,9 @@ "prepare": "node ../../scripts/prepare.js", "storybook": "start-storybook -p 9001" }, + "dependencies": { + "babel-runtime": "^6.26.0" + }, "devDependencies": { "@storybook/react": "^3.4.0-alpha.9" }, diff --git a/addons/storyshots/.babelrc b/addons/storyshots/.babelrc deleted file mode 100644 index 7ecf0273a6be..000000000000 --- a/addons/storyshots/.babelrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "presets": ["env", "stage-0", "react"], - "plugins": [ - "transform-runtime" - ] -} diff --git a/addons/storyshots/package.json b/addons/storyshots/package.json index 5b96d6543bee..bb249e2cf434 100644 --- a/addons/storyshots/package.json +++ b/addons/storyshots/package.json @@ -23,23 +23,15 @@ "global": "^4.3.2", "jest-image-snapshot": "^2.3.0", "jest-specific-snapshot": "^0.3.0", - "prop-types": "^15.6.0", "puppeteer": "^1.1.1", "read-pkg-up": "^3.0.0" }, "devDependencies": { "@storybook/addon-actions": "^3.4.0-alpha.9", + "@storybook/addon-links": "^3.4.0-alpha.9", "@storybook/addons": "^3.4.0-alpha.9", "@storybook/react": "^3.4.0-alpha.9", - "babel-cli": "^6.26.0", - "babel-jest": "^22.4.1", - "babel-plugin-transform-runtime": "^6.23.0", - "babel-preset-env": "^1.6.0", - "babel-preset-react": "^6.24.1", - "babel-preset-stage-0": "^6.24.1", "enzyme-to-json": "^3.3.1", - "jest": "^22.4.2", - "jest-cli": "^22.4.2", "react": "^16.1.0", "react-dom": "^16.1.0" }, diff --git a/addons/storyshots/stories/required_with_context/Welcome.stories.js b/addons/storyshots/stories/required_with_context/Welcome.stories.js index bec79b78a258..2837b632c0aa 100644 --- a/addons/storyshots/stories/required_with_context/Welcome.stories.js +++ b/addons/storyshots/stories/required_with_context/Welcome.stories.js @@ -1,7 +1,7 @@ import React from 'react'; -import { storiesOf } from '@storybook/react'; // eslint-disable-line -import { linkTo } from '@storybook/addon-links'; // eslint-disable-line +import { storiesOf } from '@storybook/react'; +import { linkTo } from '@storybook/addon-links'; import { Welcome } from '@storybook/react/demo'; storiesOf('Welcome', module).add('to Storybook', () => ); diff --git a/addons/storysource/package.json b/addons/storysource/package.json index 1e35b5d7aa00..4d555a4629b9 100644 --- a/addons/storysource/package.json +++ b/addons/storysource/package.json @@ -20,14 +20,15 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "acorn": "^5.3.0", + "acorn": "^5.5.0", "acorn-es7": "^0.1.0", "acorn-jsx": "^4.1.1", - "acorn-stage3": "^0.5.0", + "acorn-stage3": "^0.6.0", + "babel-runtime": "^6.26.0", "estraverse": "^4.2.0", "loader-utils": "^1.1.0", - "prettier": "^1.10.2", - "prop-types": "^15.5.10", + "prettier": "^1.11.0", + "prop-types": "^15.6.1", "react-syntax-highlighter": "^7.0.1" }, "peerDependencies": { diff --git a/addons/viewport/package.json b/addons/viewport/package.json index 6ce10ebdf97b..081c5e570e86 100644 --- a/addons/viewport/package.json +++ b/addons/viewport/package.json @@ -12,8 +12,9 @@ }, "dependencies": { "@storybook/components": "^3.4.0-alpha.9", + "babel-runtime": "^6.26.0", "global": "^4.3.2", - "prop-types": "^15.5.10" + "prop-types": "^15.6.1" }, "peerDependencies": { "@storybook/addons": "^3.3.0", diff --git a/app/angular/.babelrc b/app/angular/.babelrc deleted file mode 100644 index 845c3cf4d757..000000000000 --- a/app/angular/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["env", "stage-0", "react"] -} diff --git a/app/angular/package.json b/app/angular/package.json index 8606cb244b9f..876373cb19ed 100644 --- a/app/angular/package.json +++ b/app/angular/package.json @@ -23,8 +23,6 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addon-actions": "^3.4.0-alpha.9", - "@storybook/addon-links": "^3.4.0-alpha.9", "@storybook/addons": "^3.4.0-alpha.9", "@storybook/channel-postmessage": "^3.4.0-alpha.9", "@storybook/core": "^3.4.0-alpha.9", @@ -32,69 +30,43 @@ "@storybook/ui": "^3.4.0-alpha.9", "airbnb-js-shims": "^1.4.1", "angular2-template-loader": "^0.6.2", - "autoprefixer": "^7.2.6", - "babel-core": "^6.26.0", - "babel-loader": "^7.0.0", + "babel-loader": "^7.1.3", "babel-plugin-macros": "^2.1.0", - "babel-plugin-react-docgen": "^1.8.2", "babel-preset-env": "^1.6.0", - "babel-preset-react": "^6.24.1", - "babel-preset-react-app": "^3.1.1", "babel-preset-stage-0": "^6.24.1", "babel-runtime": "^6.23.0", "case-sensitive-paths-webpack-plugin": "^2.0.0", - "common-tags": "^1.7.2", - "configstore": "^3.1.0", "core-js": "^2.4.1", "cross-env": "^5.1.1", - "css-loader": "^0.28.10", - "dotenv-webpack": "^1.5.4", - "express": "^4.15.3", - "file-loader": "^1.1.9", - "find-cache-dir": "^1.0.0", + "dotenv-webpack": "^1.5.5", "global": "^4.3.2", "html-loader": "^0.5.5", "html-webpack-plugin": "^2.30.1", - "json-loader": "^0.5.4", - "json-stringify-safe": "^5.0.1", "json5": "^0.5.1", - "lodash.pick": "^4.4.0", "markdown-loader": "^2.0.2", "node-sass": "^4.7.2", - "postcss-flexbugs-fixes": "^3.3.0", - "postcss-loader": "^2.1.0", - "prop-types": "^15.5.10", - "qs": "^6.5.1", "raw-loader": "^0.5.1", "react": "^16.0.0", "react-dev-utils": "^5.0.0", "react-dom": "^16.0.0", - "react-modal": "^3.3.1", "redux": "^3.6.0", - "request": "^2.81.0", - "rxjs": "^5.4.2", "sass-loader": "^6.0.6", - "style-loader": "^0.20.2", "ts-loader": "^3.5.0", "uglifyjs-webpack-plugin": "^1.2.2", - "url-loader": "^0.6.2", "util-deprecate": "^1.0.2", "webpack": "^3.11.0", + "webpack-hot-middleware": "^2.21.0", "zone.js": "^0.8.20" }, "devDependencies": { - "babel-cli": "^6.26.0", - "babel-plugin-transform-decorators": "^6.24.1", - "babel-plugin-transform-decorators-legacy": "^1.3.4", - "codelyzer": "^4.1.0", "mock-fs": "^4.3.0", - "nodemon": "^1.15.1", - "typescript": "^2.7.2" + "nodemon": "^1.15.1" }, "peerDependencies": { "@angular/common": ">=4.0.0", "@angular/compiler": ">=4.0.0", "@angular/core": ">=4.0.0", + "@angular/forms": ">=4.0.0", "@angular/platform-browser": ">=4.0.0", "@angular/platform-browser-dynamic": ">=4.0.0" } diff --git a/app/angular/src/demo/welcome.component.ts b/app/angular/src/demo/welcome.component.ts index ca7a7c2f9fbb..9412e8bf246d 100644 --- a/app/angular/src/demo/welcome.component.ts +++ b/app/angular/src/demo/welcome.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, Output, EventEmitter } from '@angular/core'; @Component({ selector: 'storybook-welcome-component', @@ -15,7 +15,7 @@ import { Component } from '@angular/core'; (Basically a story is like a visual test case.)

- See these sample stories for a component called + See these sample stories for a component called Button .

@@ -77,5 +77,5 @@ import { Component } from '@angular/core'; ], }) export default class WelcomeComponent { - displayName = 'Welcome'; + @Output() showApp = new EventEmitter(); } diff --git a/app/angular/src/server/addons.js b/app/angular/src/server/addons.js deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/app/angular/src/server/babel_config.js b/app/angular/src/server/babel_config.js index 23b2adaab975..23ed1ebeea27 100644 --- a/app/angular/src/server/babel_config.js +++ b/app/angular/src/server/babel_config.js @@ -63,12 +63,5 @@ export default function(configDir) { } } - const finalConfig = babelConfig || defaultConfig; - // Ensure plugins are defined or fallback to an array to avoid empty values. - const babelConfigPlugins = finalConfig.plugins || []; - // If `babelConfigPlugins` is not an `Array`, calling `concat` will inject it - // as a single value, if it is an `Array` it will be spreaded. - finalConfig.plugins = [].concat(babelConfigPlugins); - - return finalConfig; + return babelConfig || defaultConfig; } diff --git a/app/angular/src/server/babel_config.test.js b/app/angular/src/server/babel_config.test.js deleted file mode 100644 index f587597af96d..000000000000 --- a/app/angular/src/server/babel_config.test.js +++ /dev/null @@ -1,89 +0,0 @@ -import loadBabelConfig from './babel_config'; - -// eslint-disable-next-line global-require -jest.mock('fs', () => require('../../../../__mocks__/fs')); -jest.mock('path', () => ({ - resolve: () => '.babelrc', - parse: require.requireActual('path').parse, - join: require.requireActual('path').join, - dirname: require.requireActual('path').dirname, -})); - -const setup = ({ files }) => { - // eslint-disable-next-line no-underscore-dangle, global-require - require('fs').__setMockFiles(files); -}; - -describe('babel_config', () => { - // As the 'fs' is going to be mocked, let's call require.resolve - // so the require.cache has the correct route to the file. - // In fact let's use it in the tests :) - - it('should return the config with the extra plugins when `plugins` is an array.', () => { - setup({ - files: { - '.babelrc': `{ - "presets": [ - "env", - "foo-preset" - ], - "plugins": [ - "foo-plugin" - ] - }`, - }, - }); - - const config = loadBabelConfig('.foo'); - - expect(config).toEqual({ - babelrc: false, - plugins: ['foo-plugin'], - presets: ['env', 'foo-preset'], - }); - }); - - it('should return the config with the extra plugins when `plugins` is not an array.', () => { - setup({ - files: { - '.babelrc': `{ - "presets": [ - "env", - "foo-preset" - ], - "plugins": "bar-plugin" - }`, - }, - }); - - const config = loadBabelConfig('.bar'); - - expect(config).toEqual({ - babelrc: false, - plugins: ['bar-plugin'], - presets: ['env', 'foo-preset'], - }); - }); - - it('should return the config only with the extra plugins when `plugins` is not present.', () => { - // Mock a `.babelrc` config file with no plugins key. - setup({ - files: { - '.babelrc': `{ - "presets": [ - "env", - "foo-preset" - ] - }`, - }, - }); - - const config = loadBabelConfig('.biz'); - - expect(config).toEqual({ - babelrc: false, - plugins: [], - presets: ['env', 'foo-preset'], - }); - }); -}); diff --git a/app/angular/src/server/config.js b/app/angular/src/server/config.js index 09e5f89b35a0..d9cef99d82f6 100644 --- a/app/angular/src/server/config.js +++ b/app/angular/src/server/config.js @@ -33,13 +33,10 @@ export default function(configType, baseConfig, configDir) { // Check whether addons.js file exists inside the storybook. // Load the default addons.js file if it's missing. - const storybookDefaultAddonsPath = path.resolve(__dirname, 'addons.js'); const storybookCustomAddonsPath = path.resolve(configDir, 'addons.js'); if (fs.existsSync(storybookCustomAddonsPath)) { logger.info('=> Loading custom addons config.'); config.entry.manager.unshift(storybookCustomAddonsPath); - } else { - config.entry.manager.unshift(storybookDefaultAddonsPath); } // Check whether project has Angular CLI configuration file diff --git a/app/angular/src/server/config/babel.js b/app/angular/src/server/config/babel.js index 0ce366ebe9a4..5727b2b0f256 100644 --- a/app/angular/src/server/config/babel.js +++ b/app/angular/src/server/config/babel.js @@ -12,18 +12,6 @@ module.exports = { }, ], require.resolve('babel-preset-stage-0'), - require.resolve('babel-preset-react'), - ], - plugins: [ - require.resolve('babel-plugin-macros'), - require.resolve('babel-plugin-transform-regenerator'), - [ - require.resolve('babel-plugin-transform-runtime'), - { - helpers: true, - polyfill: true, - regenerator: true, - }, - ], ], + plugins: [require.resolve('babel-plugin-macros')], }; diff --git a/app/angular/src/server/config/babel.prod.js b/app/angular/src/server/config/babel.prod.js index d772440e5eb1..2a2d52e37f4b 100644 --- a/app/angular/src/server/config/babel.prod.js +++ b/app/angular/src/server/config/babel.prod.js @@ -11,8 +11,15 @@ module.exports = { // Don't try to find .babelrc because we want to force this configuration. babelrc: false, presets: [ - require.resolve('babel-preset-env'), + [ + require.resolve('babel-preset-env'), + { + targets: { + browsers: ['last 2 versions', 'safari >= 7'], + }, + modules: false, + }, + ], require.resolve('babel-preset-stage-0'), - require.resolve('babel-preset-react'), ], }; diff --git a/app/angular/src/server/config/webpack.config.js b/app/angular/src/server/config/webpack.config.js index c9059d3cd095..1e2d4360b827 100644 --- a/app/angular/src/server/config/webpack.config.js +++ b/app/angular/src/server/config/webpack.config.js @@ -88,10 +88,10 @@ export default function(configDir) { test: /\.md$/, use: [ { - loader: 'html-loader', + loader: require.resolve('html-loader'), }, { - loader: 'markdown-loader', + loader: require.resolve('markdown-loader'), }, ], }, diff --git a/app/angular/src/server/config/webpack.config.prod.js b/app/angular/src/server/config/webpack.config.prod.js index 9465dc127fea..da46d98edbd9 100644 --- a/app/angular/src/server/config/webpack.config.prod.js +++ b/app/angular/src/server/config/webpack.config.prod.js @@ -101,10 +101,10 @@ export default function(configDir) { test: /\.md$/, use: [ { - loader: 'html-loader', + loader: require.resolve('html-loader'), }, { - loader: 'markdown-loader', + loader: require.resolve('markdown-loader'), }, ], }, diff --git a/app/angular/src/server/iframe.html.ejs b/app/angular/src/server/iframe.html.ejs index e730fdfb4231..733fdd5b82b9 100644 --- a/app/angular/src/server/iframe.html.ejs +++ b/app/angular/src/server/iframe.html.ejs @@ -5,11 +5,6 @@ - Storybook <%= htmlWebpackPlugin.options.data.previewHead %> diff --git a/app/polymer/.babelrc b/app/polymer/.babelrc deleted file mode 100644 index 845c3cf4d757..000000000000 --- a/app/polymer/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["env", "stage-0", "react"] -} diff --git a/app/polymer/package.json b/app/polymer/package.json index 76b13cbcbaf2..466d76c4ddd4 100644 --- a/app/polymer/package.json +++ b/app/polymer/package.json @@ -30,55 +30,39 @@ "@storybook/ui": "^3.4.0-alpha.9", "@webcomponents/webcomponentsjs": "^1.1.0", "airbnb-js-shims": "^1.4.1", - "autoprefixer": "^7.2.6", - "babel-core": "^6.26.0", - "babel-loader": "^7.1.2", + "babel-loader": "^7.1.3", "babel-plugin-macros": "^2.1.0", - "babel-plugin-react-docgen": "^1.8.2", "babel-plugin-transform-regenerator": "^6.26.0", "babel-plugin-transform-runtime": "^6.23.0", "babel-polyfill": "^6.26.0", "babel-preset-env": "^1.6.0", "babel-preset-minify": "^0.3.0", - "babel-preset-react": "^6.24.1", - "babel-preset-react-app": "^3.1.1", "babel-preset-stage-0": "^6.24.1", "babel-runtime": "^6.26.0", "case-sensitive-paths-webpack-plugin": "^2.1.1", "common-tags": "^1.4.0", - "configstore": "^3.1.1", "copy-webpack-plugin": "^4.4.2", "core-js": "^2.5.1", - "css-loader": "^0.28.10", - "dotenv-webpack": "^1.5.4", - "express": "^4.16.2", - "file-loader": "^1.1.9", + "dotenv-webpack": "^1.5.5", "find-cache-dir": "^1.0.0", "global": "^4.3.2", "html-webpack-plugin": "^2.30.1", - "json-loader": "^0.5.7", - "json-stringify-safe": "^5.0.1", "json5": "^0.5.1", - "lodash.pick": "^4.4.0", "polymer-webpack-loader": "2.0.1", - "postcss-flexbugs-fixes": "^3.3.0", - "postcss-loader": "^2.1.0", - "prop-types": "^15.6.0", - "qs": "^6.5.1", "react": "^16.0.0", "react-dev-utils": "^5.0.0", "react-dom": "^16.0.0", - "react-modal": "^3.3.1", "redux": "^3.7.2", - "request": "^2.83.0", - "style-loader": "^0.20.2", "uglifyjs-webpack-plugin": "^1.2.2", - "url-loader": "^0.6.2", "util-deprecate": "^1.0.2", - "webpack": "^3.11.0" + "webpack": "^3.11.0", + "webpack-hot-middleware": "^2.21.0" }, "devDependencies": { - "babel-cli": "^6.26.0", "nodemon": "^1.15.1" + }, + "peerDependencies": { + "babel-core": "^6.26.0 || ^7.0.0-0", + "babel-runtime": ">=6.0.0" } } diff --git a/app/polymer/src/server/addons.js b/app/polymer/src/server/addons.js deleted file mode 100644 index 280e2ac13658..000000000000 --- a/app/polymer/src/server/addons.js +++ /dev/null @@ -1,2 +0,0 @@ -// import '@storybook/addon-actions/register'; -// import '@storybook/addon-links/register'; diff --git a/app/polymer/src/server/babel_config.js b/app/polymer/src/server/babel_config.js index f5294fe1ca5c..23ed1ebeea27 100644 --- a/app/polymer/src/server/babel_config.js +++ b/app/polymer/src/server/babel_config.js @@ -63,20 +63,5 @@ export default function(configDir) { } } - const finalConfig = babelConfig || defaultConfig; - // Ensure plugins are defined or fallback to an array to avoid empty values. - const babelConfigPlugins = finalConfig.plugins || []; - const extraPlugins = [ - [ - require.resolve('babel-plugin-react-docgen'), - { - DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES', - }, - ], - ]; - // If `babelConfigPlugins` is not an `Array`, calling `concat` will inject it - // as a single value, if it is an `Array` it will be spreaded. - finalConfig.plugins = [].concat(babelConfigPlugins, extraPlugins); - - return finalConfig; + return babelConfig || defaultConfig; } diff --git a/app/polymer/src/server/babel_config.test.js b/app/polymer/src/server/babel_config.test.js deleted file mode 100644 index ba991adcd4e7..000000000000 --- a/app/polymer/src/server/babel_config.test.js +++ /dev/null @@ -1,110 +0,0 @@ -import loadBabelConfig from './babel_config'; - -// eslint-disable-next-line global-require -jest.mock('fs', () => require('../../../../__mocks__/fs')); -jest.mock('path', () => ({ - resolve: () => '.babelrc', -})); - -const setup = ({ files }) => { - // eslint-disable-next-line no-underscore-dangle, global-require - require('fs').__setMockFiles(files); -}; - -describe('babel_config', () => { - // As the 'fs' is going to be mocked, let's call require.resolve - // so the require.cache has the correct route to the file. - // In fact let's use it in the tests :) - const babelPluginReactDocgenPath = require.resolve('babel-plugin-react-docgen'); - - it('should return the config with the extra plugins when `plugins` is an array.', () => { - setup({ - files: { - '.babelrc': `{ - "presets": [ - "env", - "foo-preset" - ], - "plugins": [ - "foo-plugin" - ] - }`, - }, - }); - - const config = loadBabelConfig('.foo'); - - expect(config).toEqual({ - babelrc: false, - plugins: [ - 'foo-plugin', - [ - babelPluginReactDocgenPath, - { - DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES', - }, - ], - ], - presets: ['env', 'foo-preset'], - }); - }); - - it('should return the config with the extra plugins when `plugins` is not an array.', () => { - setup({ - files: { - '.babelrc': `{ - "presets": [ - "env", - "foo-preset" - ], - "plugins": "bar-plugin" - }`, - }, - }); - - const config = loadBabelConfig('.bar'); - - expect(config).toEqual({ - babelrc: false, - plugins: [ - 'bar-plugin', - [ - babelPluginReactDocgenPath, - { - DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES', - }, - ], - ], - presets: ['env', 'foo-preset'], - }); - }); - - it('should return the config only with the extra plugins when `plugins` is not present.', () => { - // Mock a `.babelrc` config file with no plugins key. - setup({ - files: { - '.babelrc': `{ - "presets": [ - "env", - "foo-preset" - ] - }`, - }, - }); - - const config = loadBabelConfig('.biz'); - - expect(config).toEqual({ - babelrc: false, - plugins: [ - [ - babelPluginReactDocgenPath, - { - DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES', - }, - ], - ], - presets: ['env', 'foo-preset'], - }); - }); -}); diff --git a/app/polymer/src/server/config.js b/app/polymer/src/server/config.js index 49ff8de4a4dc..b9b7e3364d75 100644 --- a/app/polymer/src/server/config.js +++ b/app/polymer/src/server/config.js @@ -33,13 +33,10 @@ export default function(configType, baseConfig, configDir) { // Check whether addons.js file exists inside the storybook. // Load the default addons.js file if it's missing. // Insert it after polyfills.js, but before client/manager. - const storybookDefaultAddonsPath = path.resolve(__dirname, 'addons.js'); const storybookCustomAddonsPath = path.resolve(configDir, 'addons.js'); if (fs.existsSync(storybookCustomAddonsPath)) { logger.info('=> Loading custom addons config.'); config.entry.manager.splice(1, 0, storybookCustomAddonsPath); - } else { - config.entry.manager.splice(1, 0, storybookDefaultAddonsPath); } const defaultConfig = createDefaultWebpackConfig(config); diff --git a/app/polymer/src/server/config/babel.js b/app/polymer/src/server/config/babel.js index 0ce366ebe9a4..77a413a7cb48 100644 --- a/app/polymer/src/server/config/babel.js +++ b/app/polymer/src/server/config/babel.js @@ -12,7 +12,6 @@ module.exports = { }, ], require.resolve('babel-preset-stage-0'), - require.resolve('babel-preset-react'), ], plugins: [ require.resolve('babel-plugin-macros'), diff --git a/app/polymer/src/server/config/babel.prod.js b/app/polymer/src/server/config/babel.prod.js index fe982349f250..5ceaf68bae9f 100644 --- a/app/polymer/src/server/config/babel.prod.js +++ b/app/polymer/src/server/config/babel.prod.js @@ -12,7 +12,6 @@ module.exports = { }, ], require.resolve('babel-preset-stage-0'), - require.resolve('babel-preset-react'), [ require.resolve('babel-preset-minify'), { diff --git a/app/polymer/src/server/config/webpack.config.js b/app/polymer/src/server/config/webpack.config.js index 1d0b1ccc3d96..6a4644f4ee44 100644 --- a/app/polymer/src/server/config/webpack.config.js +++ b/app/polymer/src/server/config/webpack.config.js @@ -89,10 +89,6 @@ export default function(configDir) { // Add support to NODE_PATH. With this we could avoid relative path imports. // Based on this CRA feature: https://github.com/facebookincubator/create-react-app/issues/253 modules: ['node_modules'].concat(nodePaths), - alias: { - react$: require.resolve('react'), - 'react-dom$': require.resolve('react-dom'), - }, }, performance: { hints: false, diff --git a/app/polymer/src/server/config/webpack.config.prod.js b/app/polymer/src/server/config/webpack.config.prod.js index 34cb9c69c340..65328637e227 100644 --- a/app/polymer/src/server/config/webpack.config.prod.js +++ b/app/polymer/src/server/config/webpack.config.prod.js @@ -100,10 +100,6 @@ export default function(configDir) { // Add support to NODE_PATH. With this we could avoid relative path imports. // Based on this CRA feature: https://github.com/facebookincubator/create-react-app/issues/253 modules: ['node_modules'].concat(nodePaths), - alias: { - react$: require.resolve('react'), - 'react-dom$': require.resolve('react-dom'), - }, }, }; diff --git a/app/react-native/.babelrc b/app/react-native/.babelrc deleted file mode 100644 index 845c3cf4d757..000000000000 --- a/app/react-native/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["env", "stage-0", "react"] -} diff --git a/app/react-native/package.json b/app/react-native/package.json index 0e5a335d3e51..eb4d5fb806f9 100644 --- a/app/react-native/package.json +++ b/app/react-native/package.json @@ -31,54 +31,47 @@ "@storybook/channel-websocket": "^3.4.0-alpha.9", "@storybook/core": "^3.4.0-alpha.9", "@storybook/ui": "^3.4.0-alpha.9", - "autoprefixer": "^7.2.6", - "babel-loader": "^7.1.2", + "babel-loader": "^7.1.3", "babel-plugin-macros": "^2.1.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.26.0", "babel-plugin-transform-runtime": "^6.23.0", - "babel-polyfill": "^6.26.0", "babel-preset-env": "^1.6.1", "babel-preset-minify": "^0.3.0", "babel-preset-react": "^6.24.1", - "babel-preset-stage-0": "^6.24.1", "babel-runtime": "^6.26.0", "case-sensitive-paths-webpack-plugin": "^2.1.1", "commander": "^2.14.1", - "css-loader": "^0.28.10", "express": "^4.16.2", - "file-loader": "^1.1.9", "find-cache-dir": "^1.0.0", "global": "^4.3.2", + "html-loader": "^0.5.5", "html-webpack-plugin": "^2.30.1", - "json-loader": "^0.5.7", "json5": "^0.5.1", - "postcss-loader": "^2.1.0", - "prop-types": "^15.6.0", + "markdown-loader": "^2.0.2", + "prop-types": "^15.6.1", "react-native-compat": "^1.0.0", "react-native-iphone-x-helper": "^1.0.2", "shelljs": "^0.8.1", - "style-loader": "^0.20.2", "uglifyjs-webpack-plugin": "^1.2.2", - "url-loader": "^0.6.2", "url-parse": "^1.1.9", "util-deprecate": "^1.0.2", "uuid": "^3.2.1", "webpack": "^3.11.0", "webpack-dev-middleware": "^1.12.2", "webpack-hot-middleware": "^2.21.0", - "ws": "^3.3.3" + "ws": "^4.1.0" }, "devDependencies": { "react-native": "^0.52.2" }, "peerDependencies": { "babel-core": "^6.26.0 || ^7.0.0-0", + "babel-runtime": ">=6.0.0", "react": "*", - "react-native": "0.52.2" + "react-native": ">=0.51.0" } } diff --git a/app/react-native/src/server/config/webpack.config.js b/app/react-native/src/server/config/webpack.config.js index f4048c4b380f..7739a77e6aba 100644 --- a/app/react-native/src/server/config/webpack.config.js +++ b/app/react-native/src/server/config/webpack.config.js @@ -39,10 +39,10 @@ const getConfig = options => ({ test: /\.md$/, use: [ { - loader: 'html-loader', + loader: require.resolve('html-loader'), }, { - loader: 'markdown-loader', + loader: require.resolve('markdown-loader'), }, ], }, diff --git a/app/react-native/src/server/config/webpack.config.prod.js b/app/react-native/src/server/config/webpack.config.prod.js index 629710db51b0..578a4b57ff02 100644 --- a/app/react-native/src/server/config/webpack.config.prod.js +++ b/app/react-native/src/server/config/webpack.config.prod.js @@ -59,10 +59,10 @@ const getConfig = options => { test: /\.md$/, use: [ { - loader: 'html-loader', + loader: require.resolve('html-loader'), }, { - loader: 'markdown-loader', + loader: require.resolve('markdown-loader'), }, ], }, diff --git a/app/react/.babelrc b/app/react/.babelrc deleted file mode 100644 index 845c3cf4d757..000000000000 --- a/app/react/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["env", "stage-0", "react"] -} diff --git a/app/react/package.json b/app/react/package.json index 2d59d648e753..adc959f43587 100644 --- a/app/react/package.json +++ b/app/react/package.json @@ -32,8 +32,7 @@ "@storybook/node-logger": "^3.4.0-alpha.9", "@storybook/ui": "^3.4.0-alpha.9", "airbnb-js-shims": "^1.4.1", - "autoprefixer": "^7.2.6", - "babel-loader": "^7.1.2", + "babel-loader": "^7.1.3", "babel-plugin-macros": "^2.1.0", "babel-plugin-react-docgen": "^1.8.2", "babel-plugin-transform-regenerator": "^6.26.0", @@ -41,47 +40,35 @@ "babel-preset-env": "^1.6.1", "babel-preset-minify": "^0.3.0", "babel-preset-react": "^6.24.1", - "babel-preset-react-app": "^3.1.1", "babel-preset-stage-0": "^6.24.1", "babel-runtime": "^6.26.0", "case-sensitive-paths-webpack-plugin": "^2.1.1", "common-tags": "^1.7.2", - "configstore": "^3.1.1", "core-js": "^2.5.3", - "css-loader": "^0.28.10", - "dotenv-webpack": "^1.5.4", - "express": "^4.16.2", - "file-loader": "^1.1.9", + "dotenv-webpack": "^1.5.5", "find-cache-dir": "^1.0.0", "glamor": "^2.20.40", "glamorous": "^4.11.6", "global": "^4.3.2", "html-loader": "^0.5.5", "html-webpack-plugin": "^2.30.1", - "json-loader": "^0.5.7", - "json-stringify-safe": "^5.0.1", "json5": "^0.5.1", "lodash.flattendeep": "^4.4.0", "markdown-loader": "^2.0.2", - "npmlog": "^4.1.2", - "postcss-flexbugs-fixes": "^3.3.0", - "postcss-loader": "^2.1.0", - "prop-types": "^15.6.0", - "qs": "^6.5.1", + "prop-types": "^15.6.1", "react-dev-utils": "^5.0.0", "redux": "^3.7.2", - "request": "^2.83.0", - "style-loader": "^0.20.2", "uglifyjs-webpack-plugin": "^1.2.2", - "url-loader": "^0.6.2", "util-deprecate": "^1.0.2", - "webpack": "^3.11.0" + "webpack": "^3.11.0", + "webpack-hot-middleware": "^2.21.0" }, "devDependencies": { "nodemon": "^1.15.1" }, "peerDependencies": { "babel-core": "^6.26.0 || ^7.0.0-0", + "babel-runtime": ">=6.0.0", "react": ">=15.0.0 || ^16.0.0", "react-dom": ">=15.0.0 || ^16.0.0" } diff --git a/app/react/src/server/config/webpack.config.js b/app/react/src/server/config/webpack.config.js index 7de48c12403e..2b29ad8e58ad 100644 --- a/app/react/src/server/config/webpack.config.js +++ b/app/react/src/server/config/webpack.config.js @@ -66,10 +66,10 @@ export default function(configDir) { test: /\.md$/, use: [ { - loader: 'html-loader', + loader: require.resolve('html-loader'), }, { - loader: 'markdown-loader', + loader: require.resolve('markdown-loader'), }, ], }, diff --git a/app/react/src/server/config/webpack.config.prod.js b/app/react/src/server/config/webpack.config.prod.js index 70527fac71c9..120737a15146 100644 --- a/app/react/src/server/config/webpack.config.prod.js +++ b/app/react/src/server/config/webpack.config.prod.js @@ -77,10 +77,10 @@ export default function(configDir) { test: /\.md$/, use: [ { - loader: 'html-loader', + loader: require.resolve('html-loader'), }, { - loader: 'markdown-loader', + loader: require.resolve('markdown-loader'), }, ], }, diff --git a/app/vue/.babelrc b/app/vue/.babelrc deleted file mode 100644 index 845c3cf4d757..000000000000 --- a/app/vue/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["env", "stage-0", "react"] -} diff --git a/app/vue/package.json b/app/vue/package.json index 9a4c7115c445..8669a4eeff17 100644 --- a/app/vue/package.json +++ b/app/vue/package.json @@ -23,57 +23,37 @@ "prepare": "node ../../scripts/prepare.js" }, "dependencies": { - "@storybook/addon-actions": "^3.4.0-alpha.9", - "@storybook/addon-links": "^3.4.0-alpha.9", "@storybook/addons": "^3.4.0-alpha.9", "@storybook/channel-postmessage": "^3.4.0-alpha.9", "@storybook/core": "^3.4.0-alpha.9", "@storybook/ui": "^3.4.0-alpha.9", "airbnb-js-shims": "^1.4.1", - "autoprefixer": "^7.2.6", - "babel-loader": "^7.1.2", + "babel-loader": "^7.1.3", "babel-plugin-macros": "^2.1.0", - "babel-plugin-react-docgen": "^1.8.2", "babel-plugin-transform-regenerator": "^6.26.0", "babel-plugin-transform-runtime": "^6.23.0", "babel-preset-env": "^1.6.0", "babel-preset-minify": "^0.3.0", - "babel-preset-react": "^6.24.1", - "babel-preset-react-app": "^3.1.1", "babel-preset-stage-0": "^6.24.1", "babel-runtime": "^6.26.0", "case-sensitive-paths-webpack-plugin": "^2.1.1", "common-tags": "^1.7.2", - "configstore": "^3.1.1", "core-js": "^2.5.3", - "css-loader": "^0.28.10", - "dotenv-webpack": "^1.5.4", - "express": "^4.16.2", - "file-loader": "^1.1.9", + "dotenv-webpack": "^1.5.5", "find-cache-dir": "^1.0.0", "global": "^4.3.2", "html-loader": "^0.5.5", "html-webpack-plugin": "^2.30.1", - "json-loader": "^0.5.7", - "json-stringify-safe": "^5.0.1", "json5": "^0.5.1", "markdown-loader": "^2.0.2", - "postcss-flexbugs-fixes": "^3.3.0", - "postcss-loader": "^2.1.0", - "prop-types": "^15.6.0", - "qs": "^6.5.1", "react": "^16.2.0", "react-dev-utils": "^5.0.0", "react-dom": "^16.2.0", "redux": "^3.7.2", - "request": "^2.83.0", - "style-loader": "^0.20.2", "uglifyjs-webpack-plugin": "^1.2.2", - "url-loader": "^0.6.2", "util-deprecate": "^1.0.2", - "vue-hot-reload-api": "^2.3.0", - "vue-style-loader": "^3.1.2", - "webpack": "^3.11.0" + "webpack": "^3.11.0", + "webpack-hot-middleware": "^2.21.0" }, "devDependencies": { "nodemon": "^1.15.1", @@ -83,8 +63,9 @@ }, "peerDependencies": { "babel-core": "^6.26.0 || ^7.0.0-0", - "vue": "2.5.13", - "vue-loader": "13.7.1", - "vue-template-compiler": "2.5.13" + "babel-runtime": ">=6.0.0", + "vue": ">=2.0.0", + "vue-loader": ">=13.0.0", + "vue-template-compiler": ">=2.0.0" } } diff --git a/app/vue/src/server/addons.js b/app/vue/src/server/addons.js deleted file mode 100644 index 280e2ac13658..000000000000 --- a/app/vue/src/server/addons.js +++ /dev/null @@ -1,2 +0,0 @@ -// import '@storybook/addon-actions/register'; -// import '@storybook/addon-links/register'; diff --git a/app/vue/src/server/babel_config.js b/app/vue/src/server/babel_config.js index 8eab74ed4283..5f9184d1d878 100644 --- a/app/vue/src/server/babel_config.js +++ b/app/vue/src/server/babel_config.js @@ -65,20 +65,5 @@ export default function(configDir) { } } - const finalConfig = babelConfig || defaultConfig; - // Ensure plugins are defined or fallback to an array to avoid empty values. - const babelConfigPlugins = finalConfig.plugins || []; - const extraPlugins = [ - [ - require.resolve('babel-plugin-react-docgen'), - { - DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES', - }, - ], - ]; - // If `babelConfigPlugins` is not an `Array`, calling `concat` will inject it - // as a single value, if it is an `Array` it will be spreaded. - finalConfig.plugins = [].concat(babelConfigPlugins, extraPlugins); - - return finalConfig; + return babelConfig || defaultConfig; } diff --git a/app/vue/src/server/babel_config.test.js b/app/vue/src/server/babel_config.test.js deleted file mode 100644 index ba991adcd4e7..000000000000 --- a/app/vue/src/server/babel_config.test.js +++ /dev/null @@ -1,110 +0,0 @@ -import loadBabelConfig from './babel_config'; - -// eslint-disable-next-line global-require -jest.mock('fs', () => require('../../../../__mocks__/fs')); -jest.mock('path', () => ({ - resolve: () => '.babelrc', -})); - -const setup = ({ files }) => { - // eslint-disable-next-line no-underscore-dangle, global-require - require('fs').__setMockFiles(files); -}; - -describe('babel_config', () => { - // As the 'fs' is going to be mocked, let's call require.resolve - // so the require.cache has the correct route to the file. - // In fact let's use it in the tests :) - const babelPluginReactDocgenPath = require.resolve('babel-plugin-react-docgen'); - - it('should return the config with the extra plugins when `plugins` is an array.', () => { - setup({ - files: { - '.babelrc': `{ - "presets": [ - "env", - "foo-preset" - ], - "plugins": [ - "foo-plugin" - ] - }`, - }, - }); - - const config = loadBabelConfig('.foo'); - - expect(config).toEqual({ - babelrc: false, - plugins: [ - 'foo-plugin', - [ - babelPluginReactDocgenPath, - { - DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES', - }, - ], - ], - presets: ['env', 'foo-preset'], - }); - }); - - it('should return the config with the extra plugins when `plugins` is not an array.', () => { - setup({ - files: { - '.babelrc': `{ - "presets": [ - "env", - "foo-preset" - ], - "plugins": "bar-plugin" - }`, - }, - }); - - const config = loadBabelConfig('.bar'); - - expect(config).toEqual({ - babelrc: false, - plugins: [ - 'bar-plugin', - [ - babelPluginReactDocgenPath, - { - DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES', - }, - ], - ], - presets: ['env', 'foo-preset'], - }); - }); - - it('should return the config only with the extra plugins when `plugins` is not present.', () => { - // Mock a `.babelrc` config file with no plugins key. - setup({ - files: { - '.babelrc': `{ - "presets": [ - "env", - "foo-preset" - ] - }`, - }, - }); - - const config = loadBabelConfig('.biz'); - - expect(config).toEqual({ - babelrc: false, - plugins: [ - [ - babelPluginReactDocgenPath, - { - DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES', - }, - ], - ], - presets: ['env', 'foo-preset'], - }); - }); -}); diff --git a/app/vue/src/server/config.js b/app/vue/src/server/config.js index 1ef00345b3cb..f326c4e5579d 100644 --- a/app/vue/src/server/config.js +++ b/app/vue/src/server/config.js @@ -35,13 +35,10 @@ export default function(configType, baseConfig, configDir) { // Check whether addons.js file exists inside the storybook. // Load the default addons.js file if it's missing. // Insert it after polyfills.js, but before client/manager. - const storybookDefaultAddonsPath = path.resolve(__dirname, 'addons.js'); const storybookCustomAddonsPath = path.resolve(configDir, 'addons.js'); if (fs.existsSync(storybookCustomAddonsPath)) { logger.info('=> Loading custom addons config.'); config.entry.manager.splice(1, 0, storybookCustomAddonsPath); - } else { - config.entry.manager.splice(1, 0, storybookDefaultAddonsPath); } const defaultConfig = createDefaultWebpackConfig(config); diff --git a/app/vue/src/server/config/babel.js b/app/vue/src/server/config/babel.js index 0ce366ebe9a4..77a413a7cb48 100644 --- a/app/vue/src/server/config/babel.js +++ b/app/vue/src/server/config/babel.js @@ -12,7 +12,6 @@ module.exports = { }, ], require.resolve('babel-preset-stage-0'), - require.resolve('babel-preset-react'), ], plugins: [ require.resolve('babel-plugin-macros'), diff --git a/app/vue/src/server/config/babel.prod.js b/app/vue/src/server/config/babel.prod.js index 59a87fe49bc3..0418f1a1dc3b 100644 --- a/app/vue/src/server/config/babel.prod.js +++ b/app/vue/src/server/config/babel.prod.js @@ -12,7 +12,6 @@ module.exports = { }, ], require.resolve('babel-preset-stage-0'), - require.resolve('babel-preset-react'), require.resolve('babel-preset-minify'), ], plugins: [ diff --git a/app/vue/src/server/config/webpack.config.js b/app/vue/src/server/config/webpack.config.js index f98a9b25e4ce..b06d1ffc1368 100644 --- a/app/vue/src/server/config/webpack.config.js +++ b/app/vue/src/server/config/webpack.config.js @@ -71,10 +71,10 @@ export default function(configDir) { test: /\.md$/, use: [ { - loader: 'html-loader', + loader: require.resolve('html-loader'), }, { - loader: 'markdown-loader', + loader: require.resolve('markdown-loader'), }, ], }, @@ -89,8 +89,6 @@ export default function(configDir) { modules: ['node_modules'].concat(nodePaths), alias: { vue$: require.resolve('vue/dist/vue.esm.js'), - react$: require.resolve('react'), - 'react-dom$': require.resolve('react-dom'), }, }, performance: { diff --git a/app/vue/src/server/config/webpack.config.prod.js b/app/vue/src/server/config/webpack.config.prod.js index 895ab3ad31d5..40091d93f197 100644 --- a/app/vue/src/server/config/webpack.config.prod.js +++ b/app/vue/src/server/config/webpack.config.prod.js @@ -82,10 +82,10 @@ export default function(configDir) { test: /\.md$/, use: [ { - loader: 'html-loader', + loader: require.resolve('html-loader'), }, { - loader: 'markdown-loader', + loader: require.resolve('markdown-loader'), }, ], }, @@ -100,8 +100,6 @@ export default function(configDir) { modules: ['node_modules'].concat(nodePaths), alias: { vue$: require.resolve('vue/dist/vue.esm.js'), - react$: require.resolve('react'), - 'react-dom$': require.resolve('react-dom'), }, }, }; diff --git a/docs/package.json b/docs/package.json index 4e0b41209324..856b3c2dfdee 100644 --- a/docs/package.json +++ b/docs/package.json @@ -22,30 +22,23 @@ "@storybook/addon-links": "^3.3.14", "@storybook/addons": "^3.3.14", "@storybook/react": "^3.3.14", - "babel-cli": "^6.26.0", - "babel-core": "^6.26.0", "babel-loader": "^6.4.1", - "babel-plugin-transform-runtime": "^6.23.0", - "babel-polyfill": "^6.26.0", - "babel-preset-env": "^1.6.1", - "babel-preset-react": "^6.24.1", - "babel-preset-stage-0": "^6.24.1", "bootstrap": "^3.3.7", - "gatsby": "^1.9.212", + "gatsby": "^1.9.216", "gatsby-link": "^1.6.37", - "gatsby-plugin-sharp": "^1.6.34", + "gatsby-plugin-sharp": "^1.6.35", "gatsby-remark-autolink-headers": "^1.4.12", "gatsby-remark-copy-linked-files": "^1.5.28", - "gatsby-remark-images": "^1.5.50", + "gatsby-remark-images": "^1.5.51", "gatsby-remark-smartypants": "^1.4.11", - "gatsby-source-filesystem": "^1.5.23", + "gatsby-source-filesystem": "^1.5.24", "gatsby-transformer-remark": "^1.7.33", "gh-pages": "^1.1.0", "global": "^4.3.2", "highlight.js": "^9.12.0", "lodash": "^4.17.5", - "marked": "^0.3.16", - "prop-types": "^15.6.0", + "marked": "^0.3.17", + "prop-types": "^15.6.1", "react": "^15.6.1", "react-document-title": "^2.0.3", "react-dom": "^15.6.1", diff --git a/docs/src/pages/addons/addon-gallery/index.md b/docs/src/pages/addons/addon-gallery/index.md index 47de3137a5bd..f4c080b86e45 100644 --- a/docs/src/pages/addons/addon-gallery/index.md +++ b/docs/src/pages/addons/addon-gallery/index.md @@ -46,6 +46,10 @@ Redirects console output (logs, errors, warnings) into Action Logger Panel. `wit With this addon, you can switch between background colors and background images for your preview components. It is really helpful for styleguides. +### [Viewport](https://github.com/storybooks/storybook/tree/master/addons/viewport) + +Viewport allows your stories to be displayed in different sizes and layouts in [Storybook](https://storybookjs.org). This helps build responsive components inside of Storybook. + ## Community Addons You need to install these addons directly from NPM in order to use them. diff --git a/docs/yarn.lock b/docs/yarn.lock index c27ffeaf99fb..420ea33fae92 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -2528,9 +2528,9 @@ color@^0.11.0, color@^0.11.3, color@^0.11.4: color-convert "^1.3.0" color-string "^0.3.0" -color@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/color/-/color-2.0.1.tgz#e4ed78a3c4603d0891eba5430b04b86314f4c839" +color@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/color/-/color-3.0.0.tgz#d920b4328d534a3ac8295d68f7bd4ba6c427be9a" dependencies: color-convert "^1.9.1" color-string "^1.5.2" @@ -4410,9 +4410,9 @@ gatsby-module-loader@^1.0.10: babel-runtime "^6.26.0" loader-utils "^0.2.16" -gatsby-plugin-sharp@^1.6.34: - version "1.6.34" - resolved "https://registry.yarnpkg.com/gatsby-plugin-sharp/-/gatsby-plugin-sharp-1.6.34.tgz#11cd60af3d3a9c8e77772476ba200830f7e71eb6" +gatsby-plugin-sharp@^1.6.35: + version "1.6.35" + resolved "https://registry.yarnpkg.com/gatsby-plugin-sharp/-/gatsby-plugin-sharp-1.6.35.tgz#3ef8578163b47842377f14825c98d27dc32f061d" dependencies: async "^2.1.2" babel-runtime "^6.26.0" @@ -4424,7 +4424,7 @@ gatsby-plugin-sharp@^1.6.34: potrace "^2.1.1" probe-image-size "^3.2.0" progress "^1.1.8" - sharp "^0.19.0" + sharp "^0.19.1" svgo "^0.7.2" gatsby-react-router-scroll@^1.0.11: @@ -4457,13 +4457,13 @@ gatsby-remark-copy-linked-files@^1.5.28: probe-image-size "^3.2.0" unist-util-visit "^1.1.1" -gatsby-remark-images@^1.5.50: - version "1.5.50" - resolved "https://registry.yarnpkg.com/gatsby-remark-images/-/gatsby-remark-images-1.5.50.tgz#695022db8f84385782afbb57bc57c36572367469" +gatsby-remark-images@^1.5.51: + version "1.5.51" + resolved "https://registry.yarnpkg.com/gatsby-remark-images/-/gatsby-remark-images-1.5.51.tgz#0c32af341cbc777cbfeb023355a85d5791a4fdb0" dependencies: babel-runtime "^6.26.0" cheerio "^1.0.0-rc.2" - gatsby-plugin-sharp "^1.6.34" + gatsby-plugin-sharp "^1.6.35" is-relative-url "^2.0.0" lodash "^4.17.4" slash "^1.0.0" @@ -4478,9 +4478,9 @@ gatsby-remark-smartypants@^1.4.11: retext-smartypants "^2.0.0" unist-util-visit "^1.1.1" -gatsby-source-filesystem@^1.5.23: - version "1.5.23" - resolved "https://registry.yarnpkg.com/gatsby-source-filesystem/-/gatsby-source-filesystem-1.5.23.tgz#a48432f6db6c2c702f06cb87d720e8d281c4a73b" +gatsby-source-filesystem@^1.5.24: + version "1.5.24" + resolved "https://registry.yarnpkg.com/gatsby-source-filesystem/-/gatsby-source-filesystem-1.5.24.tgz#5d1ff9b3994fff967be92f6fea27e6cf1ba75fbe" dependencies: babel-cli "^6.26.0" babel-runtime "^6.26.0" @@ -4519,9 +4519,9 @@ gatsby-transformer-remark@^1.7.33: unist-util-select "^1.5.0" unist-util-visit "^1.1.1" -gatsby@^1.9.212: - version "1.9.212" - resolved "https://registry.yarnpkg.com/gatsby/-/gatsby-1.9.212.tgz#b3b42bb2ebc75ba2d90c86a39f1a090e2f05ecec" +gatsby@^1.9.216: + version "1.9.216" + resolved "https://registry.yarnpkg.com/gatsby/-/gatsby-1.9.216.tgz#41269eb89150c871a62d11ae09a6efa3a8034dd3" dependencies: async "^2.1.2" babel-code-frame "^6.22.0" @@ -6737,9 +6737,9 @@ markdown-table@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-1.1.1.tgz#4b3dd3a133d1518b8ef0dbc709bf2a1b4824bc8c" -marked@^0.3.16: - version "0.3.16" - resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.16.tgz#2f188b7dfcfa6540fe9940adaf0f3b791c9a5cba" +marked@^0.3.17: + version "0.3.17" + resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.17.tgz#607f06668b3c6b1246b28f13da76116ac1aa2d2b" marked@^0.3.6: version "0.3.9" @@ -7100,9 +7100,9 @@ nan@^2.3.0: version "2.7.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.7.0.tgz#d95bf721ec877e08db276ed3fc6eb78f9083ad46" -nan@^2.8.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.8.0.tgz#ed715f3fe9de02b57a5e6252d90a96675e1f085a" +nan@^2.9.2: + version "2.9.2" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.9.2.tgz#f564d75f5f8f36a6d9456cca7a6c4fe488ab7866" nanomatch@^1.2.5: version "1.2.5" @@ -8562,6 +8562,14 @@ prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.6, prop-types@^15.5.8, loose-envify "^1.3.1" object-assign "^4.1.1" +prop-types@^15.6.1: + version "15.6.1" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.1.tgz#36644453564255ddda391191fb3a125cbdf654ca" + dependencies: + fbjs "^0.8.16" + loose-envify "^1.3.1" + object-assign "^4.1.1" + proper-lockfile@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/proper-lockfile/-/proper-lockfile-1.2.0.tgz#ceff5dd89d3e5f10fb75e1e8e76bc75801a59c34" @@ -9719,7 +9727,7 @@ semver@^4.0.3, semver@^4.3.3: version "4.3.6" resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.6.tgz#300bc6e0e86374f7ba61068b5b1ecd57fc6532da" -semver@^5.4.1: +semver@^5.5.0: version "5.5.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" @@ -9875,16 +9883,16 @@ shallowequal@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.0.2.tgz#1561dbdefb8c01408100319085764da3fcf83f8f" -sharp@^0.19.0: - version "0.19.0" - resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.19.0.tgz#61729e90f291e62540122a8065ca5fc70c1a8b1f" +sharp@^0.19.1: + version "0.19.1" + resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.19.1.tgz#819bf11f5c3f4ff32eb465f255b5fb87e43ceea1" dependencies: - color "^2.0.1" + color "^3.0.0" detect-libc "^1.0.3" - nan "^2.8.0" - semver "^5.4.1" + nan "^2.9.2" + semver "^5.5.0" simple-get "^2.7.0" - tar "^4.2.0" + tar "^4.4.0" tunnel-agent "^0.6.0" shebang-command@^1.2.0: @@ -10606,9 +10614,9 @@ tar@^2.2.1: fstream "^1.0.2" inherits "2" -tar@^4.2.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/tar/-/tar-4.3.0.tgz#11351be1c7944c59dd197850119c2081d8bc7fe5" +tar@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.0.tgz#3aaf8c29b6b800a8215f33efb4df1c95ce2ac2f5" dependencies: chownr "^1.0.1" fs-minipass "^1.2.3" diff --git a/examples/angular-cli/e2e/app.po.ts b/examples/angular-cli/e2e/app.po.ts index 82ea75ba504a..eb663398fd58 100644 --- a/examples/angular-cli/e2e/app.po.ts +++ b/examples/angular-cli/e2e/app.po.ts @@ -6,6 +6,6 @@ export class AppPage { } getParagraphText() { - return element(by.css('app-root h1')).getText(); + return element(by.css('storybook-app-root h1')).getText(); } } diff --git a/examples/angular-cli/karma.conf.js b/examples/angular-cli/karma.conf.js index 51fd7c6b7ee6..684edc0f86fb 100644 --- a/examples/angular-cli/karma.conf.js +++ b/examples/angular-cli/karma.conf.js @@ -30,5 +30,6 @@ module.exports = function(config) { autoWatch: true, browsers: ['Chrome'], singleRun: false, + webpack: { node: { fs: 'empty', } }, }); }; diff --git a/examples/angular-cli/package.json b/examples/angular-cli/package.json index 6517eb2fcb5d..31637584ce90 100644 --- a/examples/angular-cli/package.json +++ b/examples/angular-cli/package.json @@ -13,15 +13,12 @@ "test": "ng test" }, "dependencies": { - "@angular/animations": "^5.2.6", "@angular/common": "^5.2.6", "@angular/compiler": "^5.2.6", "@angular/core": "^5.2.6", "@angular/forms": "^5.2.6", - "@angular/http": "^5.2.6", "@angular/platform-browser": "^5.2.6", "@angular/platform-browser-dynamic": "^5.2.6", - "@angular/router": "^5.2.6", "core-js": "^2.4.1", "rxjs": "^5.4.2", "zone.js": "^0.8.20" @@ -29,7 +26,6 @@ "devDependencies": { "@angular/cli": "1.7.1", "@angular/compiler-cli": "^5.2.6", - "@angular/language-service": "^5.2.6", "@storybook/addon-actions": "^3.4.0-alpha.9", "@storybook/addon-knobs": "^3.4.0-alpha.9", "@storybook/addon-links": "^3.4.0-alpha.9", diff --git a/examples/angular-cli/src/index.html b/examples/angular-cli/src/index.html index 6834dc51f526..4d9441d0f323 100644 --- a/examples/angular-cli/src/index.html +++ b/examples/angular-cli/src/index.html @@ -9,6 +9,6 @@ - + diff --git a/examples/angular-cli/src/stories/index.ts b/examples/angular-cli/src/stories/index.ts index 785e16620a63..b7b5494cdff9 100644 --- a/examples/angular-cli/src/stories/index.ts +++ b/examples/angular-cli/src/stories/index.ts @@ -1,10 +1,13 @@ import { storiesOf } from '@storybook/angular'; import { Welcome, Button } from '@storybook/angular/demo'; import { moduleMetadata } from '@storybook/angular'; +import { linkTo } from '@storybook/addon-links'; storiesOf('Welcome', module).add('to Storybook', () => ({ - template: ``, - props: {}, + template: ``, + props: { + showApp: linkTo('Button'), + }, moduleMetadata: { declarations: [Welcome], }, diff --git a/examples/angular-cli/src/tsconfig.app.json b/examples/angular-cli/src/tsconfig.app.json index 39ba8dbacbbe..16b78476d452 100644 --- a/examples/angular-cli/src/tsconfig.app.json +++ b/examples/angular-cli/src/tsconfig.app.json @@ -4,7 +4,9 @@ "outDir": "../out-tsc/app", "baseUrl": "./", "module": "es2015", - "types": [] + "types": [ + "node" + ] }, "exclude": [ "test.ts", diff --git a/examples/cra-kitchen-sink/package.json b/examples/cra-kitchen-sink/package.json index 72a0fcf5a503..2d90d7566ba2 100644 --- a/examples/cra-kitchen-sink/package.json +++ b/examples/cra-kitchen-sink/package.json @@ -11,10 +11,8 @@ "test": "react-scripts test --env=jsdom" }, "dependencies": { - "glamor": "^2.20.40", - "glamorous": "^4.11.6", "global": "^4.3.2", - "prop-types": "^15.6.0", + "prop-types": "^15.6.1", "react": "^16.2.0", "react-dom": "^16.2.0" }, @@ -31,16 +29,14 @@ "@storybook/addon-notes": "^3.4.0-alpha.9", "@storybook/addon-options": "^3.4.0-alpha.9", "@storybook/addon-storyshots": "^3.4.0-alpha.9", - "@storybook/addon-viewport": "^3.4.0-alpha.9", "@storybook/addons": "^3.4.0-alpha.9", "@storybook/client-logger": "^3.4.0-alpha.9", - "@storybook/components": "^3.4.0-alpha.9", "@storybook/react": "^3.4.0-alpha.9", - "babel-jest": "^22.4.1", + "babel-runtime": "^6.26.0", "enzyme": "^3.3.0", "enzyme-adapter-react-16": "^1.1.0", "enzyme-to-json": "^3.3.1", - "jest": "^22.4.2", + "jest": "^20.0.4", "react-scripts": "^1.1.1", "webpack": "^3.11.0" } diff --git a/examples/cra-kitchen-sink/src/storyshots.test.js b/examples/cra-kitchen-sink/src/storyshots.test.js index 6d3e890de2e2..a1ba7e1d5044 100644 --- a/examples/cra-kitchen-sink/src/storyshots.test.js +++ b/examples/cra-kitchen-sink/src/storyshots.test.js @@ -1,9 +1,12 @@ import initStoryshots, { multiSnapshotWithOptions } from '@storybook/addon-storyshots'; import path from 'path'; -import { render as renderer } from 'enzyme'; +import { render as renderer, configure } from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; import serializer from 'enzyme-to-json'; +configure({ adapter: new Adapter() }); + initStoryshots({ framework: 'react', configPath: path.join(__dirname, '..', '.storybook'), diff --git a/examples/crna-kitchen-sink/package.json b/examples/crna-kitchen-sink/package.json index 4c4f88991140..9a8d318628fb 100644 --- a/examples/crna-kitchen-sink/package.json +++ b/examples/crna-kitchen-sink/package.json @@ -7,14 +7,17 @@ "@storybook/addon-knobs": "file:../../packs/storybook-addon-knobs.tgz", "@storybook/addon-links": "file:../../packs/storybook-addon-links.tgz", "@storybook/addon-options": "file:../../packs/storybook-addon-options.tgz", - "@storybook/addon-storyshots": "file:../../packs/storybook-addon-storyshots.tgz", "@storybook/addons": "file:../../packs/storybook-addons.tgz", "@storybook/channel-postmessage": "file:../../packs/storybook-channel-postmessage.tgz", + "@storybook/channel-websocket": "file:../../packs/storybook-channel-websocket.tgz", "@storybook/channels": "file:../../packs/storybook-channels.tgz", + "@storybook/client-logger": "file:../../packs/storybook-client-logger.tgz", "@storybook/components": "file:../../packs/storybook-components.tgz", "@storybook/core": "file:../../packs/storybook-core.tgz", + "@storybook/node-logger": "file:../../packs/storybook-node-logger.tgz", "@storybook/react-native": "file:../../packs/storybook-react-native.tgz", "@storybook/ui": "file:../../packs/storybook-ui.tgz", + "babel-runtime": "^6.26.0", "jest-expo": "^24.0.0", "react-native-scripts": "^1.8.1", "react-test-renderer": "~16.2.0", diff --git a/examples/official-storybook/package.json b/examples/official-storybook/package.json index 476d3607c8f2..25e2cd578a24 100644 --- a/examples/official-storybook/package.json +++ b/examples/official-storybook/package.json @@ -13,7 +13,6 @@ "@storybook/addon-a11y": "^3.4.0-alpha.9", "@storybook/addon-actions": "^3.4.0-alpha.9", "@storybook/addon-backgrounds": "^3.4.0-alpha.9", - "@storybook/addon-centered": "^3.4.0-alpha.9", "@storybook/addon-events": "^3.4.0-alpha.9", "@storybook/addon-info": "^3.4.0-alpha.9", "@storybook/addon-jest": "^3.4.0-alpha.9", @@ -25,19 +24,15 @@ "@storybook/addon-storysource": "^3.4.0-alpha.9", "@storybook/addon-viewport": "^3.4.0-alpha.9", "@storybook/addons": "^3.4.0-alpha.9", - "@storybook/components": "^3.4.0-alpha.9", "@storybook/node-logger": "^3.4.0-alpha.9", "@storybook/react": "^3.4.0-alpha.9", - "babel-jest": "^22.4.1", - "enzyme": "^3.3.0", - "enzyme-adapter-react-16": "^1.1.0", + "babel-runtime": "^6.26.0", "enzyme-to-json": "^3.3.1", "eventemitter3": "^3.0.1", "format-json": "^1.0.3", "global": "^4.3.2", - "jest": "^22.4.2", "paths.macro": "^2.0.2", - "prop-types": "^15.6.0", + "prop-types": "^15.6.1", "react": "^16.2.0", "react-chromatic": "^0.7.10", "react-dom": "^16.2.0", diff --git a/examples/polymer-cli/.storybook/addons.js b/examples/polymer-cli/.storybook/addons.js index aa7f0807eda1..d910c5810835 100644 --- a/examples/polymer-cli/.storybook/addons.js +++ b/examples/polymer-cli/.storybook/addons.js @@ -2,5 +2,6 @@ import '@storybook/addon-storysource/register'; import '@storybook/addon-actions/register'; import '@storybook/addon-notes/register'; import '@storybook/addon-knobs/register'; +import '@storybook/addon-links/register'; import '@storybook/addon-viewport/register'; import '@storybook/addon-options/register'; diff --git a/examples/polymer-cli/package.json b/examples/polymer-cli/package.json index 4f985baecffb..0f9b296ccadd 100644 --- a/examples/polymer-cli/package.json +++ b/examples/polymer-cli/package.json @@ -3,6 +3,7 @@ "version": "3.4.0-alpha.9", "private": true, "scripts": { + "build-storybook": "build-storybook", "start": "webpack-dev-server", "storybook": "start-storybook -p 9001 -c .storybook" }, @@ -10,6 +11,7 @@ "@polymer/polymer": "^2.5.0", "@storybook/addon-actions": "^3.4.0-alpha.9", "@storybook/addon-knobs": "^3.4.0-alpha.9", + "@storybook/addon-links": "^3.4.0-alpha.9", "@storybook/addon-notes": "^3.4.0-alpha.9", "@storybook/addon-options": "^3.4.0-alpha.9", "@storybook/addon-storysource": "^3.4.0-alpha.9", @@ -21,13 +23,11 @@ "webpack": "^3.11.0" }, "devDependencies": { - "babel": "^6.23.0", "babel-core": "^6.26.0", - "babel-loader": "^7.1.2", - "babel-preset-env": "^1.6.1", - "babel-preset-stage-2": "^6.24.1", + "babel-loader": "^7.1.3", + "babel-runtime": "^6.26.0", "copy-webpack-plugin": "^4.4.2", "html-webpack-plugin": "^2.30.1", - "webpack-dev-server": "^2.11.1" + "webpack-dev-server": "^2.11.2" } } diff --git a/examples/polymer-cli/src/simple-button.html b/examples/polymer-cli/src/simple-button.html new file mode 100644 index 000000000000..85952920b05b --- /dev/null +++ b/examples/polymer-cli/src/simple-button.html @@ -0,0 +1,36 @@ + + + + + + + diff --git a/examples/polymer-cli/src/stories/addon-actions.stories.js b/examples/polymer-cli/src/stories/addon-actions.stories.js index a39f87544aa3..3b29471cbc13 100644 --- a/examples/polymer-cli/src/stories/addon-actions.stories.js +++ b/examples/polymer-cli/src/stories/addon-actions.stories.js @@ -2,14 +2,16 @@ import { storiesOf } from '@storybook/polymer'; import { action } from '@storybook/addon-actions'; import { document } from 'global'; +import '../simple-button.html'; + storiesOf('Addon|Actions', module) .add('Action only', () => { - const el = document.createElement('playground-button'); + const el = document.createElement('simple-button'); el.addEventListener('click', action('log1')); return el; }) .add('Action and method', () => { - const el = document.createElement('playground-button'); + const el = document.createElement('simple-button'); el.addEventListener('click', e => action('log2')(e.target)); return el; }); diff --git a/examples/polymer-cli/src/stories/addon-links.stories.js b/examples/polymer-cli/src/stories/addon-links.stories.js new file mode 100644 index 000000000000..ee4ecf88660d --- /dev/null +++ b/examples/polymer-cli/src/stories/addon-links.stories.js @@ -0,0 +1,12 @@ +import { storiesOf } from '@storybook/polymer'; +import { linkTo } from '@storybook/addon-links'; +import { document } from 'global'; + +import '../simple-button.html'; + +storiesOf('Addon|Links', module).add('With Create Element', () => { + const el = document.createElement('simple-button'); + el.title = 'Go to welcome'; + el.handleClick = linkTo('Welcome'); + return el; +}); diff --git a/examples/polymer-cli/src/stories/index.stories.js b/examples/polymer-cli/src/stories/index.stories.js index 641787592c40..a457591e7827 100644 --- a/examples/polymer-cli/src/stories/index.stories.js +++ b/examples/polymer-cli/src/stories/index.stories.js @@ -1,13 +1,16 @@ import { storiesOf } from '@storybook/polymer'; +import { linkTo } from '@storybook/addon-links'; +import { document } from 'global'; import '../polymer-playground-app.html'; import '../playground-button.html'; import './storybook-welcome-to-polymer.html'; -storiesOf('Welcome', module).add( - 'Welcome', - () => '' -); +storiesOf('Welcome', module).add('Welcome', () => { + const el = document.createElement('storybook-welcome-to-polymer'); + el.goToButton = linkTo('Button'); + return el; +}); storiesOf('App', module).add( 'full app', diff --git a/examples/polymer-cli/src/stories/storybook-welcome-to-polymer.html b/examples/polymer-cli/src/stories/storybook-welcome-to-polymer.html index d0fd9c6d03de..c053752f7c88 100644 --- a/examples/polymer-cli/src/stories/storybook-welcome-to-polymer.html +++ b/examples/polymer-cli/src/stories/storybook-welcome-to-polymer.html @@ -39,7 +39,7 @@

Welcome to Storybook for Polymer

(Basically a story is like a visual test case.)

- See these sample stories for a component called playground-button + See these sample stories for a component called playground-button

@@ -71,7 +71,22 @@

Welcome to Storybook for Polymer

diff --git a/examples/react-native-vanilla/package.json b/examples/react-native-vanilla/package.json index dc91e6e16d01..c259f338abab 100644 --- a/examples/react-native-vanilla/package.json +++ b/examples/react-native-vanilla/package.json @@ -13,8 +13,8 @@ "react-native": "^0.51.0" }, "devDependencies": { - "babel-jest": "^22.0.4", "babel-preset-react-native": "^4.0.0", + "babel-runtime": "^6.26.0", "jest": "^22.0.4", "react-test-renderer": "^16.2.0", "@storybook/addon-actions": "file:../../packs/storybook-addon-actions.tgz", @@ -24,9 +24,12 @@ "@storybook/addon-storyshots": "file:../../packs/storybook-addon-storyshots.tgz", "@storybook/addons": "file:../../packs/storybook-addons.tgz", "@storybook/channels": "file:../../packs/storybook-channels.tgz", + "@storybook/client-logger": "file:../../packs/storybook-client-logger.tgz", "@storybook/channel-postmessage": "file:../../packs/storybook-channel-postmessage.tgz", + "@storybook/channel-websocket": "file:../../packs/storybook-channel-websocket.tgz", "@storybook/components": "file:../../packs/storybook-components.tgz", "@storybook/core": "file:../../packs/storybook-core.tgz", + "@storybook/node-logger": "file:../../packs/storybook-node-logger.tgz", "@storybook/react-native": "file:../../packs/storybook-react-native.tgz", "@storybook/ui": "file:../../packs/storybook-ui.tgz", "react-dom": "^16.2.0" diff --git a/examples/vue-kitchen-sink/package.json b/examples/vue-kitchen-sink/package.json index 75d3c0676391..cd3a715f1c99 100644 --- a/examples/vue-kitchen-sink/package.json +++ b/examples/vue-kitchen-sink/package.json @@ -25,17 +25,13 @@ "@storybook/addons": "^3.4.0-alpha.9", "@storybook/vue": "^3.4.0-alpha.9", "babel-core": "^6.26.0", - "babel-loader": "^7.1.2", + "babel-loader": "^7.1.3", "babel-preset-env": "^1.6.0", "babel-preset-vue": "^2.0.1", "cross-env": "^5.1.3", - "css-loader": "^0.28.10", - "file-loader": "^1.1.9", - "vue-hot-reload-api": "^2.3.0", + "file-loader": "^1.1.10", "vue-loader": "^13.7.1", - "vue-style-loader": "^3.1.2", - "vue-template-compiler": "^2.5.13", "webpack": "^3.11.0", - "webpack-dev-server": "^2.11.1" + "webpack-dev-server": "^2.11.2" } } diff --git a/examples/vue-kitchen-sink/src/stories/Welcome.vue b/examples/vue-kitchen-sink/src/stories/Welcome.vue index 42e291c2cc53..20217f381ea7 100644 --- a/examples/vue-kitchen-sink/src/stories/Welcome.vue +++ b/examples/vue-kitchen-sink/src/stories/Welcome.vue @@ -16,7 +16,7 @@

See these sample - stories + stories for a component called Button . @@ -54,6 +54,13 @@