Skip to content

Commit

Permalink
Merge branch 'master' into eslint-strict
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen authored May 19, 2017
2 parents 600cbce + a47d8d1 commit 08a49db
Show file tree
Hide file tree
Showing 11 changed files with 189 additions and 73 deletions.
23 changes: 0 additions & 23 deletions .jestrc.json

This file was deleted.

88 changes: 83 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
[![Build Status](https://travis-ci.org/storybooks/storybook.svg?branch=master)](https://travis-ci.org/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://storybooks-slackin.herokuapp.com/badge.svg)](https://storybooks-slackin.herokuapp.com/)
[![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 is a development environment for UI components.
It allows you to browse a component library, view the different states of each component, and interactively develop and test components.
Expand All @@ -30,16 +33,18 @@ Once it's installed, you can `npm run storybook` and it will run the development

For full documentation on using Storybook visit: [storybooks.js.org](https://storybooks.js.org)

## Main Projects
## Projects

### Main Projects
- [Storybook for react](app/react) - Storybook for React components
- [Storybook for react-native](app/react-native) - Storybook for React components

## Sub Projects
- [Storyshots](lib/storyshots) - Easy snapshot testing for storybook
### Sub Projects
- [CLI](lib/cli) - Streamlined installation for a variety of app types
- [examples](examples) - Code examples to illustrate different Storybook use cases

## Addons
### Addons
- [addon-storyshots](addons/storyshots) - Easy snapshot testing for storybook
- [addon-actions](addons/actions/) - Log actions as users interact with components in storybook
- [addon-comments](addons/comments/) - Comment on storybook stories
- [addon-graphql](addons/graphql/) - Query a GraphQL server within Storybook stories
Expand All @@ -52,3 +57,76 @@ For full documentation on using Storybook visit: [storybooks.js.org](https://sto

We welcome contributions to Storybook! There are many ways to contribute to
this project. [Get started here](CONTRIBUTING.md)


### Backers

Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/storybook#backer)]

<a href="https://opencollective.com/storybook/backer/0/website" target="_blank"><img src="https://opencollective.com/storybook/backer/0/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/1/website" target="_blank"><img src="https://opencollective.com/storybook/backer/1/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/2/website" target="_blank"><img src="https://opencollective.com/storybook/backer/2/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/3/website" target="_blank"><img src="https://opencollective.com/storybook/backer/3/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/4/website" target="_blank"><img src="https://opencollective.com/storybook/backer/4/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/5/website" target="_blank"><img src="https://opencollective.com/storybook/backer/5/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/6/website" target="_blank"><img src="https://opencollective.com/storybook/backer/6/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/7/website" target="_blank"><img src="https://opencollective.com/storybook/backer/7/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/8/website" target="_blank"><img src="https://opencollective.com/storybook/backer/8/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/9/website" target="_blank"><img src="https://opencollective.com/storybook/backer/9/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/10/website" target="_blank"><img src="https://opencollective.com/storybook/backer/10/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/11/website" target="_blank"><img src="https://opencollective.com/storybook/backer/11/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/12/website" target="_blank"><img src="https://opencollective.com/storybook/backer/12/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/13/website" target="_blank"><img src="https://opencollective.com/storybook/backer/13/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/14/website" target="_blank"><img src="https://opencollective.com/storybook/backer/14/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/15/website" target="_blank"><img src="https://opencollective.com/storybook/backer/15/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/16/website" target="_blank"><img src="https://opencollective.com/storybook/backer/16/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/17/website" target="_blank"><img src="https://opencollective.com/storybook/backer/17/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/18/website" target="_blank"><img src="https://opencollective.com/storybook/backer/18/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/19/website" target="_blank"><img src="https://opencollective.com/storybook/backer/19/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/20/website" target="_blank"><img src="https://opencollective.com/storybook/backer/20/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/21/website" target="_blank"><img src="https://opencollective.com/storybook/backer/21/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/22/website" target="_blank"><img src="https://opencollective.com/storybook/backer/22/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/23/website" target="_blank"><img src="https://opencollective.com/storybook/backer/23/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/24/website" target="_blank"><img src="https://opencollective.com/storybook/backer/24/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/25/website" target="_blank"><img src="https://opencollective.com/storybook/backer/25/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/26/website" target="_blank"><img src="https://opencollective.com/storybook/backer/26/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/27/website" target="_blank"><img src="https://opencollective.com/storybook/backer/27/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/28/website" target="_blank"><img src="https://opencollective.com/storybook/backer/28/avatar.svg"></a>
<a href="https://opencollective.com/storybook/backer/29/website" target="_blank"><img src="https://opencollective.com/storybook/backer/29/avatar.svg"></a>


### Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/storybook#sponsor)]

<a href="https://opencollective.com/storybook/sponsor/0/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/1/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/2/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/3/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/4/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/5/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/6/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/7/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/8/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/9/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/10/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/11/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/11/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/12/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/12/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/13/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/13/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/14/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/14/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/15/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/15/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/16/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/16/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/17/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/17/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/18/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/18/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/19/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/19/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/20/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/20/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/21/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/21/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/22/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/22/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/23/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/23/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/24/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/24/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/25/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/25/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/26/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/26/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/27/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/27/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/28/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/28/avatar.svg"></a>
<a href="https://opencollective.com/storybook/sponsor/29/website" target="_blank"><img src="https://opencollective.com/storybook/sponsor/29/avatar.svg"></a>

2 changes: 1 addition & 1 deletion addons/info/src/components/PropTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default class PropTable extends React.Component {
<th>propType</th>
<th>required</th>
<th>default</th>
<th>description&gt;</th>
<th>description</th>
</tr>
</thead>
<tbody>
Expand Down
6 changes: 5 additions & 1 deletion app/react/src/client/preview/client_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class ClientApi {

storiesOf(kind, m) {
if (!kind && typeof kind !== 'string') {
throw new Error('Invalid kind provided for stories, should be a string');
throw new Error('Invalid or missing kind provided for stories, should be a string');
}

if (m && m.hot) {
Expand All @@ -51,6 +51,10 @@ export default class ClientApi {
});

api.add = (storyName, getStory) => {
if (typeof storyName !== 'string') {
throw new Error(`Invalid or missing storyName provided for a "${kind}" story.`);
}

if (this._storyStore.hasStory(kind, storyName)) {
throw new Error(`Story of "${kind}" named "${storyName}" already exists`);
}
Expand Down
2 changes: 1 addition & 1 deletion app/react/src/server/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ shelljs.cp(path.resolve(__dirname, 'public/favicon.ico'), outputDir);
// custom `.babelrc` file and `webpack.config.js` files
// NOTE changes to env should be done before calling `getBaseConfig`
const config = loadConfig('PRODUCTION', getBaseConfig(), configDir);
config.output.path = outputDir;
config.output.path = path.resolve(outputDir);

// copy all static files
if (program.staticDir) {
Expand Down
24 changes: 11 additions & 13 deletions app/react/src/server/config/defaults/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,7 @@ import { includePaths, excludePaths } from '../utils';
// Add a default custom config which is similar to what React Create App does.
module.exports = storybookBaseConfig => {
const newConfig = { ...storybookBaseConfig };
newConfig.plugins = [
...storybookBaseConfig.plugins,
new webpack.LoaderOptionsPlugin({
options: {
postcss: [
autoprefixer({
browsers: ['>1%', 'last 4 versions', 'Firefox ESR', 'not ie < 9'],
}),
],
},
}),
];

newConfig.module.rules = [
...storybookBaseConfig.module.rules,
{
Expand All @@ -31,7 +20,16 @@ module.exports = storybookBaseConfig => {
importLoaders: 1,
},
},
'postcss-loader',
{
loader: 'postcss-loader',
options: {
plugins: () => [
autoprefixer({
browsers: ['>1%', 'last 4 versions', 'Firefox ESR', 'not ie < 9'],
}),
],
},
},
],
},
{
Expand Down
14 changes: 14 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
cacheDirectory: '.cache/jest',
clearMocks: true,
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/__mocks__/fileMock.js',
'\\.(css|scss)$': '<rootDir>/__mocks__/styleMock.js',
},
projects: ['<rootDir>/packages/*', '<rootDir>/examples/*'],
collectCoverage: false,
collectCoverageFrom: ['packages/**/*.{js,jsx}', '!**/generators/**'],
coverageDirectory: 'coverage',
testEnvironment: 'jsdom',
setupTestFrameworkScriptFile: './node_modules/jest-enzyme/lib/index.js',
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
/* eslint-disable */
import '@kadira/storybook-addon-knobs/register';
import '@kadira/storybook-addon-options/register';
import '@kadira/storybook/addons';
import { storiesOf } from '@kadira/storybook';
import '@kadira/storybook-addons';
import '@kadira/react-storybook-decorator-centered';
import '@kadira/storybook-addon-comments';
import '@kadira/storybook-addon-graphql';
import '@kadira/storybook-addon-info';
import '@kadira/storybook-addon-knobs';
import '@kadira/storybook-addon-links';
import '@kadira/storybook-addon-notes';
import '@kadira/storybook-addon-options';
import 'storyshots';
import '@kadira/storybook-channels';
import '@kadira/storybook-channel-postmsg';
import '@kadira/storybook-channel-websocket';
import '@kadira/getstorybook';
import '@kadira/react-storybook';
import '@kadira/react-native-storybook';
import '@kadira/storybook-ui';
import { storiesOf } from '@kadira/react-storybook';
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
/* eslint-disable */
import '@storybook/storybook-addon-knobs/register';
import '@storybook/storybook-addon-options/register';
import '@storybook/storybook/addons';
import { storiesOf } from '@storybook/storybook';
import '@storybook/addons';
import '@storybook/addon-centered';
import '@storybook/addon-comments';
import '@storybook/addon-graphql';
import '@storybook/addon-info';
import '@storybook/addon-knobs';
import '@storybook/addon-links';
import '@storybook/addon-notes';
import '@storybook/addon-options';
import '@storybook/addon-storyshots';
import '@storybook/channels';
import '@storybook/channel-postmessage';
import '@storybook/channel-websocket';
import '@storybook/cli';
import '@storybook/react';
import '@storybook/react-native';
import '@storybook/ui';
import { storiesOf } from '@storybook/react';
Loading

0 comments on commit 08a49db

Please sign in to comment.