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

Programmatic way to launch Storybook #146

Closed
mquandalle opened this issue Apr 25, 2016 · 4 comments
Closed

Programmatic way to launch Storybook #146

mquandalle opened this issue Apr 25, 2016 · 4 comments

Comments

@mquandalle
Copy link

In an application I’m developing I have a root directory called tools/ that contains various things to spawn Webpack dev server, or Graph_i_QL, or run scripts. I would like to define Storybook configuration in tools/storybook.js and be able to call it using JavaScript methods instead of using the start-storybook command line interface. That would allow things like:

$ npm run dev
Application is available at http://localhost:3000
GraphiQL is available at http://localhost:4000
StoryBook is available at http://localhost:5000

How to do that?

@arunoda
Copy link
Member

arunoda commented Apr 25, 2016

You can change the config directory using this API: https://github.com/kadirahq/react-storybook/blob/master/docs/configure_storybook.md#configuration-directory

You may use shelljs to run the storybook command.

@mquandalle
Copy link
Author

But can I change the config.js filename?

@arunoda
Copy link
Member

arunoda commented Apr 25, 2016

We have many config files, so it's always better to store them in a directory. (even if you've just the config.js file)

So, I think changing that's not ideal.
But I'm open to find a way to run the storybook manually.

@mquandalle mquandalle changed the title Customizing the config location Programmatic way to launch Storybook Apr 26, 2016
@thani-sh
Copy link
Contributor

Hi @mquandalle
A storybook express middleware is available from v1.28.0.

import storybook from '@kadira/storybook/dist/server/middleware';

// ...
app.use(storybook(configDirectory));
// ...

Check this line

Related: #208

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

No branches or pull requests

3 participants