phenixdigital / phoenix_storybook

A pluggable storybook for your Phoenix components.
MIT License
674 stars 54 forks source link

protocol consolidation in storybook files #429

Closed tcoopman closed 2 months ago

tcoopman commented 7 months ago

I have something like this in my storybook files:

  defmodule StoryBookCommand do
    @derive [Jason.Encoder]
    defstruct [:value]
  end

but the consolidation doesn't work because the storybook file is a script (I think that's the reason). How should I solve this?

cblavier commented 7 months ago

Hey Thomas, I have no idea as I don't use protocols very much. What is the StorybookCommand module? a component? a story?

tcoopman commented 7 months ago

I have a component that renders Commands. A Command takes a payload that has to be a struct that implements the Jason.Encoder.

In my storybook files, instead of depending on payloads from the production code, I wanted to create a custom payload: StorybookCommand. The issue is that it seems that protocol consolidation doesn't run for exs files?

Maybe a solution for me could be to put the StorybookCommand module somewhere else. Are there ex files where I can put this module? Similar to test/support?

cblavier commented 2 months ago

Hey Thomas, I was able to reproduce it, but have no idea how to fix it. Is this still an issue? did you find your way?

tcoopman commented 2 months ago

Hi @cblavier I've worked around it - so I don't have a need for it.