storybook-addon-themes icon indicating copy to clipboard operation
storybook-addon-themes copied to clipboard

Addon breaks compilation in Storybook 6.2.x

Open KrofDrakula opened this issue 3 years ago • 4 comments

storybook-addon-themes installs its own version of @storybook/[email protected] 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.

KrofDrakula avatar Apr 06 '21 06:04 KrofDrakula

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.

tonai avatar Apr 08 '21 17:04 tonai

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.

KrofDrakula avatar Apr 08 '21 17:04 KrofDrakula

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...

tonai avatar Apr 14 '21 13:04 tonai

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

Frikki avatar Jun 10 '21 10:06 Frikki