Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add database support for addons #415

Merged
merged 6 commits into from Sep 1, 2016
Merged

Add database support for addons #415

merged 6 commits into from Sep 1, 2016

Conversation

thani-sh
Copy link
Contributor

Add a new addon database feature which can be used by addons to persist data with the storybook. The default configuration stores data in a JSON file inside the storybook config directory (.storybook).

@@ -4,6 +4,7 @@ import React from 'react';
import { Provider } from '@kadira/storybook-ui';
import addons from '@kadira/storybook-addons';
import createChannel from '@kadira/storybook-channel-pagebus';
import createDatabase from '@kadira/storybook-database-local';
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to move this to another repo? If there's a reason we can move the server code too. (I mean the middleware)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need this on RN storybook also. I'll move the middle ware tomorrow. Please hold this PR until then.

Copy link
Member

Choose a reason for hiding this comment

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

Move it to the same module. We can import the middleware like this:

import middleware from '@kadira/storybook-database-local/dist/middleware'

@arunoda
Copy link
Member

arunoda commented Sep 1, 2016

This is cool.

@@ -64,7 +65,9 @@ if (program.staticDir) {
// Build the webpack configuration using the `baseConfig`
// custom `.babelrc` file and `webpack.config.js` files
const configDir = program.configDir || './.storybook';
const dbPath = path.resolve(configDir, 'datastore.json');
Copy link
Member

Choose a reason for hiding this comment

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

For now, we should disable this by default.
We should enable saving data, if a user asked to do that via an option.

We can change that later, but until we figure things out this needs to be opt-in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about -d -- enable-db flags for start-storybook command?

Copy link
Member

Choose a reason for hiding this comment

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

Yep. That's good.

@arunoda
Copy link
Member

arunoda commented Sep 1, 2016

I think we can get this. Do a release.

@thani-sh thani-sh merged commit 4b30879 into master Sep 1, 2016
@thani-sh thani-sh deleted the datastore branch September 1, 2016 13:52
@thani-sh
Copy link
Contributor Author

thani-sh commented Sep 1, 2016

Released v2.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants