storybook-rsbuild icon indicating copy to clipboard operation
storybook-rsbuild copied to clipboard

Framework name is not stripped in terminal log

Open fi3ework opened this issue 1 year ago • 5 comments

The builder name log is verbose as shown below, which is much more verbose than Vite or webpack framework. There's a strip function https://github.com/storybookjs/storybook/blob/a5c7f7fd16643c3aa85fceb9149e3d2e83b9ef7d/code/lib/core-server/src/build-dev.ts#L216-L219 which only works with @storybook/name frameworks.

image

img_v3_02av_562a3eef-18b8-456f-ab5d-8ae3f61b7fbg

fi3ework avatar May 21 '24 04:05 fi3ework

it shows a full path because the framework option is from getAbsolutePath. it's okay if we use framework: 'storybook-react-rsbuild' instead of framework: getAbsolutePath('storybook-react-rsbuild')

image

https://github.com/storybookjs/storybook/blob/a5c7f7fd16643c3aa85fceb9149e3d2e83b9ef7d/code/lib/core-server/src/build-dev.ts#L81

tmkx avatar Jun 21 '24 08:06 tmkx

@tmkx Yes, it will. However, it's very prone to failed to find addons / builder / frameworks in a pnpm monorepo without a resolved dep path. (see how frequency getAbsolutePath is being used in Storybook https://github.com/search?q=repo%3Astorybookjs%2Fstorybook%20getAbsolutePath&type=code)

fi3ework avatar Jun 21 '24 08:06 fi3ework

I mean it works as expected in user's projects. it shows the full path in this repo only.

the users use 'storybook-react-rsbuild' directly, which doesn't have this issue.

tmkx avatar Jun 21 '24 09:06 tmkx

It will show as expected in user project ONLY IF they don't use getAbsolutePath. But official's framework will show the neat name EVEN WITH getAbsolutePath.

fi3ework avatar Jun 21 '24 09:06 fi3ework

i see, this may occur in a monorepo which shares Storybook dependencies. agree with u that it's better to do something like frameworkName.split(/[\\/]/).at(-1) in storybook

tmkx avatar Jun 21 '24 09:06 tmkx