tonai / storybook-addon-themes

MIT License
83 stars 30 forks source link

Addon breaks compilation in Storybook 6.2.x #49

Open KrofDrakula opened 3 years ago

KrofDrakula commented 3 years ago

storybook-addon-themes installs its own version of @storybook/api@6.1.x which is incompatible with Storybook v6.2.x.

It should define @storybook/* dependencies as devDependencies and peerDependencies in order to avoid breaking for future versions. That would enable developing the addon normally by installing the dependencies directly, but when published and consumed, would use the peer dependency provided by the actual installed version.

tonai commented 3 years ago

Hello @KrofDrakula , I tried to reproduce your problem without success. I understand what you mean but if I can't reproduce your problem, I can't check that it will fix it. Dependencies for @storybook/* are declared as ^6.0.16 in my test project (it is declared as ^6.0.0 in this addon) and it only installed version 6.2.5 that is ok for both cases.

KrofDrakula commented 3 years ago

Hm, this could be a Yarn issue, then. It seems that upgrading Storybook packages that we depend on directly from 6.1 to 6.2 doesn't propagate to this addon's dependencies which remain at 6.1.x after upgrading.

I guess the only way to resolve the current situation would be removing the 6.1.x references from the yarn lockfile and rerun installation, which would hopefully pick up the updated dependencies. With peerDependencies, the addon would just use the top-level version and not be out of date, but that might require version detection for @storybook/api in case there is an incompatible change between versions.

tonai commented 3 years ago

Maybe it is because we doesn't require to use the last version in this package.json. Storybook addons declare their dependencies the same way than this addon, but they use fixed version (https://github.com/storybookjs/storybook/blob/next/addons/backgrounds/package.json => 6.3.0-alpha.7). We declare dependencies like that ^6.0.0, but in my case I can't use fixed version...

Frikki commented 3 years ago

Shouldn’t such a dependency be declared as a peerDependency?