storybookjs / addon-designs

A Storybook addon that embeds Figma, websites, or images in the addon panel.
https://storybookjs.github.io/addon-designs
MIT License
869 stars 73 forks source link

Remove unnecessary peer dependencies #201

Closed valentinpalkovic closed 10 months ago

valentinpalkovic commented 1 year ago

All storybook packages, which are mentioned in https://github.com/storybookjs/storybook/blob/next/code/ui/manager/src/globals/runtime.ts don't have to be defined as peer dependencies, since they are made available when the Storybook Manager gets bundled. The @storybook/preview-api was not used at all.

ghengeveld commented 1 year ago

Interesting. Does this apply to any addon? We have a few more (e.g. pseudo-states, visual-tests) that are specifying peerDeps on SB packages. Maybe they needn't do that?

pocka commented 1 year ago

These were added in #133 in order not to trigger errors on strict package managers (e.g. pnpm, Yarn PnP). I'm not sure it's still a problem in the current SB architecture though.

ndelangen commented 1 year ago

@ghengeveld The manager-side of addons will get their storybook dependencies replaced by esbuild with globals.

The preview-side will get @storybook/preview-api externalized by both the webpack and vite builders. But the preview side is more fragile, because users can change it's builder-config.

So if you have @storybook/* dependencies (or to be more precise, these) https://github.com/storybookjs/storybook/blob/c7028c7b9fdaa77b224c081a8f187906042098d3/code/ui/manager/src/globals/runtime.ts#L17-L33 ...then you can don't need to supply those packages at runtime. You do (and this is very important) need to ensure those dependencies aren't bundled in!

yannbf commented 11 months ago

@ndelangen @valentinpalkovic what are the next steps here?

ndelangen commented 11 months ago

@JReinhold This is a good contender to try our react-peerdependencies removal work on.

ghengeveld commented 10 months ago

Is this still going anywhere?

yannbf commented 10 months ago

@JReinhold reminder to recheck this ☝️