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

Addon-docs, blocks: Prebundle dependencies #29301

Merged
merged 6 commits into from
Oct 9, 2024
Merged

Conversation

JReinhold
Copy link
Contributor

@JReinhold JReinhold commented Oct 8, 2024

Works on #29038

What I did

Before After
pkg-size image image
npmgraph image image

Sources

https://pkg-size.dev/@storybook%[email protected]?no-peers

https://pkg-size.dev/@storybook%[email protected]?no-peers

https://npmgraph.js.org/?q=@storybook/[email protected]#hide=

https://npmgraph.js.org/?q=@storybook/[email protected]#zoom=w

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 pull request has been released as version 0.0.0-pr-29301-sha-991d41fc. Try it out in a new sandbox by running npx [email protected] sandbox or in an existing project with npx [email protected] upgrade.

More information
Published version 0.0.0-pr-29301-sha-991d41fc
Triggered by @JReinhold
Repository storybookjs/storybook
Branch jeppe/prebundle-addon-docs
Commit 991d41fc
Datetime Tue Oct 8 20:01:14 UTC 2024 (1728417674)
Workflow run 11242809433

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=29301

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 78.7 MB 78.7 MB 0 B 0.83 0%
initSize 148 MB 147 MB -1 MB -4.13 -0.7%
diffSize 69.3 MB 68.3 MB -1 MB -3.74 -1.5%
buildSize 6.79 MB 6.79 MB 4.49 kB 5.4 0.1%
buildSbAddonsSize 1.5 MB 1.5 MB -281 B -Infinity 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.83 MB 1.83 MB 0 B 0.58 0%
buildSbPreviewSize 270 kB 270 kB 0 B - 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.8 MB 3.8 MB -281 B 0.29 0%
buildPreviewSize 2.99 MB 2.99 MB 4.77 kB 5.7 0.2%
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 16.5s 23.4s 6.8s 1.66 🔺29.3%
generateTime 20.6s 18.6s -2s -1ms -1.18 -10.7%
initTime 13.5s 12.5s -1s -27ms -1.37 🔰-8.2%
buildTime 8.2s 8.2s 8ms -0.8 0.1%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 6.7s 5.8s -870ms -1.18 -14.9%
devManagerResponsive 4.1s 3.9s -251ms -1.15 -6.4%
devManagerHeaderVisible 587ms 541ms -46ms -0.78 -8.5%
devManagerIndexVisible 618ms 563ms -55ms -0.87 -9.8%
devStoryVisibleUncached 1s 851ms -176ms -0.91 -20.7%
devStoryVisible 617ms 570ms -47ms -0.79 -8.2%
devAutodocsVisible 495ms 494ms -1ms -0.31 -0.2%
devMDXVisible 519ms 457ms -62ms -0.88 -13.6%
buildManagerHeaderVisible 492ms 449ms -43ms -1.14 -9.6%
buildManagerIndexVisible 495ms 460ms -35ms -1.15 -7.6%
buildStoryVisible 525ms 716ms 191ms 1.09 26.7%
buildAutodocsVisible 445ms 504ms 59ms -0.05 11.7%
buildMDXVisible 496ms 437ms -59ms -0.84 -13.5%

Greptile Summary

This PR focuses on prebundling dependencies for the addon-docs and blocks packages to reduce Storybook's install footprint. Key changes include:

  • Removed several dependencies from @storybook/blocks package.json, moving them to devDependencies
  • Replaced imports of global from '@storybook/global' with direct use of globalThis across multiple files
  • Simplified code in various components by removing unnecessary imports and using standardized global object access
  • Updated package.json files to optimize dependencies and reduce bundle size

These changes align with the goal of reducing Storybook's install size and dependency count, as outlined in issue #29038.

Copy link

nx-cloud bot commented Oct 8, 2024

☁️ Nx Cloud Report

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

@JReinhold JReinhold marked this pull request as ready for review October 8, 2024 21:16
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.

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

@@ -1,6 +1,3 @@
import { global as globalThis } from '@storybook/global';
import { fn } from '@storybook/test';

export default {
component: globalThis.Components.Button,
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: globalThis is used without being imported. Ensure it's available in the global scope.

@@ -100,20 +100,19 @@
"@mdx-js/react": "^3.0.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this can't be prebundled because it's stringly-referenced a few places.

@JReinhold JReinhold merged commit 5659e1b into next Oct 9, 2024
57 of 59 checks passed
@JReinhold JReinhold deleted the jeppe/prebundle-addon-docs branch October 9, 2024 13:20
@github-actions github-actions bot mentioned this pull request Oct 9, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants