Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Add Rsbuild frameworks to known frameworks #28694

Merged
merged 3 commits into from
Aug 16, 2024

Conversation

fi3ework
Copy link
Contributor

@fi3ework fi3ework commented Jul 23, 2024

Closes rspack-contrib/storybook-rsbuild#51.

What I did

Add storybook-react-rsbuild and storybook-vue3-rsbuild to known frameworks, which could make the former being detected as an react framework.

Checklist for Contributors

Testing

  1. Create an Rsbuild-react project npm create rsbuild@latest
  2. Add Storybook https://rsbuild.dev/community/releases/v0-7#support-for-storybook
  3. Try to use save from controls / add new component UI

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This pull request has been released as version 0.0.0-pr-28694-sha-b28ec221. Try it out in a new sandbox by running npx storybook@0.0.0-pr-28694-sha-b28ec221 sandbox or in an existing project with npx storybook@0.0.0-pr-28694-sha-b28ec221 upgrade.

More information
Published version 0.0.0-pr-28694-sha-b28ec221
Triggered by @shilman
Repository fi3ework/storybook
Branch patch-3
Commit b28ec221
Datetime Sun Aug 11 19:42:52 UTC 2024 (1723405372)
Workflow run 10342303731

To request a new release of this pull request, mention the @storybookjs/core team.

core team members can create a new canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=28694

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 76.3 MB 76.3 MB 0 B 0.57 0%
initSize 169 MB 169 MB 869 B 1.24 0%
diffSize 92.6 MB 92.7 MB 869 B 1.24 0%
buildSize 7.46 MB 7.46 MB 0 B 1.23 0%
buildSbAddonsSize 1.61 MB 1.61 MB 0 B 1.28 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 2.3 MB 2.3 MB 0 B 1.21 0%
buildSbPreviewSize 351 kB 351 kB 0 B -0.46 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 4.46 MB 4.46 MB 0 B 1.23 0%
buildPreviewSize 3 MB 3 MB 0 B 1.22 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 18.7s 15.2s -3s -489ms -0.04 -22.8%
generateTime 20.8s 20.5s -279ms 0.15 -1.4%
initTime 19.3s 17.2s -2s -85ms -0.25 -12.1%
buildTime 11.4s 12.5s 1s 0.15 8.5%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 8.2s 6.5s -1s -699ms -1.19 -25.9%
devManagerResponsive 5.4s 4.4s -1s -57ms -0.99 -24%
devManagerHeaderVisible 816ms 1s 278ms 3.38 🔺25.4%
devManagerIndexVisible 863ms 1.1s 273ms 3.25 🔺24%
devStoryVisibleUncached 1.5s 1.2s -346ms -0.55 -27.6%
devStoryVisible 875ms 1.1s 263ms 3.03 🔺23.1%
devAutodocsVisible 684ms 728ms 44ms -0.16 6%
devMDXVisible 695ms 650ms -45ms -0.89 -6.9%
buildManagerHeaderVisible 857ms 725ms -132ms -0.29 -18.2%
buildManagerIndexVisible 866ms 726ms -140ms -0.34 -19.3%
buildStoryVisible 963ms 796ms -167ms -0.01 -21%
buildAutodocsVisible 774ms 635ms -139ms -0.83 -21.9%
buildMDXVisible 723ms 611ms -112ms -0.73 -18.3%

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Added storybook-react-rsbuild and storybook-vue3-rsbuild to the known frameworks list to ensure proper detection and categorization.

  • Modified code/core/src/common/utils/get-storybook-info.ts to include storybook-react-rsbuild and storybook-vue3-rsbuild in the frameworkPackages object.
  • Ensures storybook-react-rsbuild is categorized as a react framework.
  • Ensures storybook-vue3-rsbuild is categorized as a vue framework.
  • No security issues or logical errors identified; compatibility with existing infrastructure should be verified.

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@shilman shilman changed the title Core: add Rsbuild frameworks to known frameworks Core: Add Rsbuild frameworks to known frameworks Jul 28, 2024
@shilman shilman added maintenance User-facing maintenance tasks core ci:normal labels Jul 28, 2024
@shilman shilman self-assigned this Jul 28, 2024
@shilman shilman added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Jul 28, 2024
Copy link

nx-cloud bot commented Jul 28, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit cff0346. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fi3ework thanks for the PR! react/vue3 are renderers not frameworks, so you'll probably need to add react-rsbuild and vue3-rsbuild to the list of SupportedFrameworks, etc.

@fi3ework
Copy link
Contributor Author

@fi3ework thanks for the PR! react/vue3 are renderers not frameworks, so you'll probably need to add react-rsbuild and vue3-rsbuild to the list of SupportedFrameworks, etc.

Thanks for hinting. I used to open the PR in github.dev so sorry for missing modifying others. There's one place blocking me here https://github.com/storybookjs/storybook/blob/next/code/lib/cli/src/helpers.ts#L141-L159. Since Rsbuild builder is either of the two core builder, there seems no way to change the code under the current code premise.

@jeffijoe
Copy link

jeffijoe commented Aug 7, 2024

@shilman any guidance for which core builder to use? Maybe webpack since Rspack is based on Webpack's API?

@shilman
Copy link
Member

shilman commented Aug 11, 2024

@fi3ework @jeffijoe Sorry for the slow response. AFAICT that constant frameworkToDefaultBuilder is only used in one place, which is here https://github.com/storybookjs/storybook/blob/next/code/lib/cli-storybook/src/automigrate/fixes/webpack5-compiler-setup.ts#L59-L70

I'm unsure if that code even needs updating, since it's purpose is to migrate from older versions of Storybook to post-8.0 conventions. And these Rsbuild frameworks are presumably 8.0+. But if it was necessary to include the new frameworks, I would probably change the type like this:

- export const frameworkToDefaultBuilder: Record<SupportedFrameworks, CoreBuilder> = {
+ export const frameworkToDefaultBuilder: Record<SupportedFrameworks, CoreBuilder | string> = {

@fi3ework
Copy link
Contributor Author

Thank you, @shilman, for the kind suggestion. I have updated the code.

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's even nicer. Thanks @fi3ework !!

@shilman
Copy link
Member

shilman commented Aug 11, 2024

@fi3ework @jeffijoe I've released a canary at 0.0.0-pr-28694-sha-b28ec221. Mind testing it out to verify that it works as expected?

@jeffijoe
Copy link

@shilman just tested it, everything works and the + button to create new stories for components also works! Great work, thank you! 🙏

@shilman shilman merged commit b0a936f into storybookjs:next Aug 16, 2024
49 of 51 checks passed
@shilman shilman removed the patch:yes Bugfix & documentation PR that need to be picked to main branch label Aug 17, 2024
@shilman shilman added the needs qa Indicates that this needs manual QA during the upcoming minor/major release label Aug 28, 2024
@JReinhold JReinhold removed the needs qa Indicates that this needs manual QA during the upcoming minor/major release label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:normal core maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creating new stories and saving stories in UI is not currently supported?
5 participants