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

React: Prebundle all of renderers/react's dependencies #29298

Merged
merged 5 commits into from
Oct 8, 2024

Conversation

ndelangen
Copy link
Member

@ndelangen ndelangen commented Oct 8, 2024

What I did

  • Move most dependencies in renderers/react to devDependencies, making them get bundled in.
  • Add prop-types as a dep to all sandboxes that will get the stories (for testing) from renderer/react. This used to work, by accident, because prop-types was provided as a dep by renderers/react.

Checklist for Contributors

Testing

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 PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

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

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 78.7 MB 78.7 MB 0 B 0.91 0%
initSize 149 MB 148 MB -1.18 MB -4.31 -0.8%
diffSize 70.5 MB 69.3 MB -1.18 MB -3.72 -1.7%
buildSize 6.77 MB 6.79 MB 16.3 kB 0.19 0.2%
buildSbAddonsSize 1.5 MB 1.5 MB 0 B -0.23 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.83 MB 1.83 MB 0 B -0.2 0%
buildSbPreviewSize 270 kB 270 kB 0 B -0.23 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.8 MB 3.8 MB 0 B -0.21 0%
buildPreviewSize 2.97 MB 2.99 MB 16.3 kB 684.23 0.5%
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 5.5s 6.1s 678ms -1.28 🔺11%
generateTime 20.3s 21s 645ms -0.15 3.1%
initTime 13.4s 14.2s 806ms -0.43 5.7%
buildTime 19.4s 9.2s -10s -202ms -0.45 -110.3%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 6.6s 7s 370ms -0.33 5.3%
devManagerResponsive 4.4s 4.5s 92ms -0.36 2%
devManagerHeaderVisible 825ms 634ms -191ms 0.03 -30.1%
devManagerIndexVisible 851ms 675ms -176ms 0.08 -26.1%
devStoryVisibleUncached 1.1s 772ms -331ms -1.03 -42.9%
devStoryVisible 852ms 669ms -183ms 0.02 -27.4%
devAutodocsVisible 504ms 428ms -76ms -0.97 -17.8%
devMDXVisible 496ms 534ms 38ms -0.17 7.1%
buildManagerHeaderVisible 461ms 535ms 74ms -0.34 13.8%
buildManagerIndexVisible 464ms 621ms 157ms 0.02 25.3%
buildStoryVisible 526ms 624ms 98ms -0.13 15.7%
buildAutodocsVisible 417ms 514ms 97ms -0.19 18.9%
buildMDXVisible 423ms 480ms 57ms -0.42 11.9%

Greptile Summary

This pull request focuses on prebundling dependencies for the Storybook React renderer and adjusting sandbox templates. Here are the key changes:

  • Modified package.json in code/renderers/react/ to move dependencies to devDependencies for prebundling
  • Updated sandbox-templates.ts to add 'prop-types' as an extra dependency for React-based templates
  • Adjusted import statements for 'react-element-to-jsx-string' in React renderer files to improve bundling
  • Added type assertions for the imported 'react-element-to-jsx-string' library to enhance type safety

@ndelangen ndelangen added the maintenance User-facing maintenance tasks label Oct 8, 2024
@ndelangen ndelangen requested a review from JReinhold October 8, 2024 09:09
@ndelangen ndelangen added the react label Oct 8, 2024
@ndelangen ndelangen self-assigned this Oct 8, 2024
Copy link

nx-cloud bot commented Oct 8, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 3990e4e. 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.

@ndelangen ndelangen added ci:normal ci:daily Run the CI jobs that normally run in the daily job. and removed ci:normal labels Oct 8, 2024
@ndelangen ndelangen changed the title React: Prebundle all of renderer/react React: Prebundle all of renderers/react's dependencies Oct 8, 2024
@ndelangen ndelangen marked this pull request as ready for review October 8, 2024 11:56
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.

LGTM

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

@JReinhold JReinhold merged commit bc07da7 into next Oct 8, 2024
109 checks passed
@JReinhold JReinhold deleted the norbert/prebundle-renderer-react branch October 8, 2024 18:24
@github-actions github-actions bot mentioned this pull request Oct 8, 2024
5 tasks
@JReinhold JReinhold added dependencies and removed maintenance User-facing maintenance tasks labels Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:daily Run the CI jobs that normally run in the daily job. dependencies react
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants