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

Test: Remove unused util dependency #29310

Merged
merged 2 commits into from
Oct 14, 2024
Merged

Test: Remove unused util dependency #29310

merged 2 commits into from
Oct 14, 2024

Conversation

JReinhold
Copy link
Contributor

@JReinhold JReinhold commented Oct 9, 2024

Works on #29038

What I did

@storybook/test and @storybook/instrumenter originally included the util package as a dependency, because otherwise building them would fail with:

Error: Build failed with 1 error:
../../node_modules/loupe/lib/index.js:30:29: ERROR: Could not read from file: /Users/jeppe/dev/work/storybook/storybook/code/lib/node_modules/util/util.js

That's because loupe does require('util'). But it does so conditionally, as the whole point of loupe is to add support for inspect across Node and browsers, so it's fine if util isn't present. Our builder doesn't know that of course - causing the error, but marking util as external instead fixes that problem.

util is still a dependency of @storybook/core, but this is a low-effort step in the right direction.

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 1.67 kB 0.75 0%
initSize 148 MB 148 MB 1.68 kB -2.45 0%
diffSize 69.3 MB 69.3 MB 10 B -2.35 0%
buildSize 6.79 MB 6.79 MB 0 B 2.96 0%
buildSbAddonsSize 1.5 MB 1.5 MB 0 B - 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.83 MB 1.83 MB 0 B 0.5 0%
buildSbPreviewSize 270 kB 270 kB 0 B - 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.8 MB 3.8 MB 0 B 0.5 0%
buildPreviewSize 2.99 MB 2.99 MB 0 B 3 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 11.3s 21.4s 10.1s 1.47 🔺47.1%
generateTime 19.7s 22.4s 2.7s 0.56 12.2%
initTime 12.8s 14.3s 1.4s -0.32 10.3%
buildTime 8.9s 8.8s -78ms -0.53 -0.9%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 6.7s 6.4s -323ms -0.62 -5%
devManagerResponsive 4.6s 4.2s -402ms -0.7 -9.6%
devManagerHeaderVisible 616ms 660ms 44ms 0.7 6.7%
devManagerIndexVisible 647ms 690ms 43ms 0.62 6.2%
devStoryVisibleUncached 815ms 1.1s 366ms 0.06 31%
devStoryVisible 648ms 691ms 43ms 0.61 6.2%
devAutodocsVisible 537ms 649ms 112ms 1.88 🔺17.3%
devMDXVisible 530ms 473ms -57ms -0.66 -12.1%
buildManagerHeaderVisible 831ms 583ms -248ms 0.15 -42.5%
buildManagerIndexVisible 856ms 586ms -270ms 0.03 -46.1%
buildStoryVisible 857ms 619ms -238ms 0.06 -38.4%
buildAutodocsVisible 477ms 508ms 31ms 0.12 6.1%
buildMDXVisible 466ms 511ms 45ms 0.06 8.8%

Greptile Summary

This PR removes the unused 'util' dependency from multiple Storybook packages and marks it as external in the bundler configuration.

  • Removed 'util' dependency from '@storybook/instrumenter' and '@storybook/test' packages
  • Added 'util' to the 'externals' array in bundler configuration for affected packages
  • Removed 'chai' dependency from '@storybook/core' package
  • These changes are part of a broader effort to reduce Storybook's install footprint (Issue [Tracking] Reduce install footprint 🐾 #29038)

@JReinhold JReinhold self-assigned this Oct 9, 2024
@JReinhold JReinhold marked this pull request as ready for review October 9, 2024 13:13
@JReinhold JReinhold requested a review from kasperpeulen October 9, 2024 13:13
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

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

Copy link

nx-cloud bot commented Oct 9, 2024

☁️ Nx Cloud Report

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

Sent with 💌 from NxCloud.

Copy link
Contributor

@kasperpeulen kasperpeulen left a comment

Choose a reason for hiding this comment

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

LGTM!

@JReinhold JReinhold merged commit f0af3e0 into next Oct 14, 2024
63 of 70 checks passed
@JReinhold JReinhold deleted the jeppe/cleanup-util-dep branch October 14, 2024 13:27
@github-actions github-actions bot mentioned this pull request Oct 14, 2024
11 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