storybookjs / storybook-addon-console

storybook-addon. Redirects console output into action logger panel
https://storybookjs.github.io/storybook-addon-console
MIT License
200 stars 21 forks source link

Support for Storybook 7 #65

Closed Bowriverstudio closed 1 year ago

Bowriverstudio commented 1 year ago

Is there documentation for using this plugin in Storybook 7?

IanVS commented 1 year ago

What error are you seeing? It looks like this addon was written for 5.x style, which means it probably could use some updates, though it sounds like people had it working in 6.5 by importing it into their .storybook/preview.js. Is that no longer working? Would you be interested in updating the project to match the newer style of addons?

sheriffMoose commented 1 year ago

@IanVS if I may, I implemented the same concepts with v7 in @storybook-extras/console. Please let me know if you would like to consolidate our efforts, either here or there, I am open to all. Thanks.

IanVS commented 1 year ago

That's great, @sheriffMoose, thanks for that. Is your version a drop-in for this one? I think we could either deprecate this one and point folks to yours, or maybe you'd like to get this version up to snuff? This one has 100,000 weekly downloads, so maybe it's worth fixing up? @ndelangen do you have thoughts here?

sheriffMoose commented 1 year ago

@IanVS it is not a drop in unfortunately, I developed it initially to be part of the Angular Extras addons, I just moved it to a separate package a few days ago. And the plan is to maintain it long term. Let me know what you prefer. I do not want to disrupt this addon since it is widely used.

Bowriverstudio commented 1 year ago

@sheriffMoose - thank you I'll take a look at that plugin.

@IanVS When I include this: in my preview.js file

import { withConsole } from "@storybook/addon-console";
import { addDecorator } from "@storybook/react";
addDecorator((storyFn, context) => withConsole()(storyFn)(context));

I get the warning: Typescript warning: '"@storybook/react"' has no exported member named 'addDecorator'. Did you mean 'Decorator'?

I believe addDecorator is deperdated in SB7. https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#dropped-support-for-addon-actions-adddecorators

IanVS commented 1 year ago

Based on this comment you just need to import for side-effects: https://github.com/storybookjs/storybook-addon-console/issues/41#issuecomment-809101235

ndelangen commented 1 year ago

I'd be awesome if someone would be able to upgrade this to use tsup, and bring it up to date with 7.0.

takurinton commented 1 year ago

Hello. Thanks again for this great library.

I am interested in this assignment and actually tried to move it around at hand. I don't know if this contribution is worth it, but for now I can confirm that debugging, build passed and all tests pass using storybook v7 at hand. https://github.com/takurinton/storybook-addon-console/pull/1

If this is worthwhile, I am ready to create a pull request to this repository.

Can I contribute to this??

ndelangen commented 1 year ago

@takurinton Shame I only see your message now. I just release v2.0.0 of this package making it compatible with storybook 7.0.0.

It still could use a bunch of work, I think, so you're definitely welcome to upgrade this package further.!