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

Feature Request: Should we unify and configure storybook in one place? #3242

Closed
mshaaban088 opened this issue Mar 19, 2018 · 11 comments
Closed

Comments

@mshaaban088
Copy link
Contributor

mshaaban088 commented Mar 19, 2018

Issue details

I see every addon comes/might come with its own configuration/customization approaches, and I think we can benefit from addon-options to unify all of the configurations as described below:

  1. setOptions is called with all the needed configurations
setOptions({
  name: 'My Storybook',
  goFullScreen: false,
  addons: {
    'storybook-addon-viewport': {  // or 'viewports' for simplicity 
      defaultViewport: 'Kindle Fire 2',
      viewports: {
        name: 'Kindle Fire 2',
        styles: {
          width: '600px',
          height: '963px'
        }
      }
    }
  }
});
  1. addon-options is responsible to emit a configure/options-event with the passed configurations
  2. storybook-addon-viewport for instances takes its configuration and adjusts accordingly.

I think we should also use the addon unique-ID to be used as a configuration key

This is just my proposal and of course open for feedbacks, what do you think?

Edit:

I think if we go for the addon unique-ID, it will be easy to dispatch separate event for each addon with the subset of configuration needed for that addon, like

// in addon-options
channel.emit('storybook-addon-viewport/configure', {
  defaultViewport: 'Kindle Fire 2',
  viewports: {
    name: 'Kindle Fire 2',
    styles: {
      width: '600px',
      height: '963px'
    }
  }
});
@igor-dv
Copy link
Member

igor-dv commented Mar 20, 2018

We can think of something like that for the v4 release since it will be breaking. I would go further with that by making config.js even more formatted - webpack style.

for example

module.exports = {
   stories: () => {}, 
   addons: () => {},  
   babelConfig,
   webpackConfig,
   tsConfig,
}

This way we can control a lifecycle of storybook config.

@mshaaban088
Copy link
Contributor Author

I like the way you formatted config.js

@mshaaban088
Copy link
Contributor Author

As we are talking about v4, do you think options should only be supported as an addon, because I think it should be included by default (e.g. part of config.js)

@mrlubos
Copy link

mrlubos commented Mar 21, 2018

+1 @igor-dv for the idea to reuse standard structure people understand from Webpack. So often new tools require people to learn a completely new set of commands, muscle memory would be thankful for this one!

@igor-dv
Copy link
Member

igor-dv commented Mar 21, 2018

I don't want to take a full credit on that since I think @ndelangen was the first to suggest it somewhere =)

do you think options should only be supported as an addon

IMO it shouldn't be an addon =)

@mrlubos
Copy link

mrlubos commented Mar 21, 2018

@igor-dv Honestly, just using the same config for most popular tools would make front-end development so much easier to pick up or maintain project in my opinion 👏

@mshaaban088
Copy link
Contributor Author

Exactly, that's what I meant. I phrased it wrong by putting only, but you got the point ;-)

@stale stale bot added the inactive label Apr 11, 2018
@ndelangen
Copy link
Member

In the long long term, a overhaul of config/settings is inevitable.

I like the idea @mshaaban088 actually brings up here to actually facilitate "settings for addons". Certainly something we want to address in the overhaul.

@stale stale bot removed the inactive label Apr 11, 2018
@stale stale bot added the inactive label May 2, 2018
@storybookjs storybookjs deleted a comment from stale bot May 14, 2018
@stale stale bot removed the inactive label May 14, 2018
@storybookjs storybookjs deleted a comment from stale bot May 14, 2018
@ndelangen ndelangen self-assigned this May 14, 2018
@stale stale bot added the inactive label Jun 4, 2018
@stale stale bot closed this as completed Jul 4, 2018
@ndelangen ndelangen reopened this Jul 6, 2018
@stale stale bot removed the inactive label Jul 6, 2018
@stale stale bot added the inactive label Jul 27, 2018
@ndelangen ndelangen removed the inactive label Aug 1, 2018
@ndelangen ndelangen added this to the v5.0.0 milestone Aug 1, 2018
@stale stale bot added the inactive label Aug 22, 2018
@igor-dv
Copy link
Member

igor-dv commented Aug 22, 2018

It's in the roadmap now.
https://storybook.canny.io/roadmap/p/universal-config-file

@stale stale bot removed the inactive label Aug 22, 2018
@igor-dv igor-dv added the todo label Aug 22, 2018
@storybookjs storybookjs deleted a comment from stale bot Aug 22, 2018
@storybookjs storybookjs deleted a comment from stale bot Aug 22, 2018
@storybookjs storybookjs deleted a comment from stale bot Aug 22, 2018
@storybookjs storybookjs deleted a comment from stale bot Aug 22, 2018
@pksunkara
Copy link
Member

Related to #4169.

@ndelangen
Copy link
Member

Let's consider this a duplicate of #4169.

@issue-sh issue-sh bot removed the todo label Dec 1, 2018
@ndelangen ndelangen removed this from the v5.0.0 milestone Dec 1, 2018
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

6 participants