-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Changes from 5 commits
17daa45
00db207
cc4d678
a2e6a1c
fb2e404
014fc27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import program from 'commander'; | |
import path from 'path'; | ||
import fs from 'fs'; | ||
import storybook from './middleware'; | ||
import datastore from '@kadira/storybook-database-local/dist/server/middleware'; | ||
import packageJson from '../../package.json'; | ||
import { parseList, getEnvConfig } from './utils'; | ||
import { track, dontTrack } from './track_usage'; | ||
|
@@ -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'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For now, we should disable this by default. We can change that later, but until we figure things out this needs to be opt-in. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep. That's good. |
||
app.use(storybook(configDir)); | ||
app.use('/db', datastore(dbPath)); | ||
|
||
app.listen(...listenAddr, function (error) { | ||
if (error) { | ||
|
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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: