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: Replace lodash with es-toolkit #28981

Draft
wants to merge 8 commits into
base: next
Choose a base branch
from
Draft

Conversation

ndelangen
Copy link
Member

@ndelangen ndelangen commented Aug 27, 2024

Closes: #28611

What I did

lodash is hard to tree-shake, it's CJS, and we want to move to less heavy, ESM dependencies.

This replaces lodash for es-toolkit which is mostly a drop-in replacement ♥️

I've only changed the core for now.

before:
Screenshot 2024-08-27 at 16 02 20

after:
Screenshot 2024-08-27 at 16 02 26

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 76.4 MB 76.4 MB 0 B 0.5 0%
initSize 161 MB 161 MB -279 kB -0.94 -0.2%
diffSize 84.8 MB 84.5 MB -279 kB -0.94 -0.3%
buildSize 7.48 MB 7.3 MB -177 kB -28.7 -2.4%
buildSbAddonsSize 1.62 MB 1.55 MB -66.4 kB -1054.6 -4.3%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 2.31 MB 2.26 MB -48.8 kB -13.22 -2.2%
buildSbPreviewSize 352 kB 311 kB -41 kB -1059.25 🔰-13.2%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 4.47 MB 4.32 MB -156 kB -48.43 -3.6%
buildPreviewSize 3.01 MB 2.98 MB -21 kB -5.22 -0.7%
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 7s 21.5s 14.5s 0.7 67.5%
generateTime 19.7s 22.9s 3.2s 0.53 14%
initTime 16s 18.6s 2.5s 1.14 13.8%
buildTime 11.5s 11.8s 334ms -0.46 2.8%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 6.9s 7.7s 849ms 0.59 10.9%
devManagerResponsive 4.5s 4.9s 390ms 0.43 7.8%
devManagerHeaderVisible 793ms 709ms -84ms -1.18 -11.8%
devManagerIndexVisible 830ms 740ms -90ms -1.24 🔰-12.2%
devStoryVisibleUncached 1.4s 1.4s -1ms 0.17 -0.1%
devStoryVisible 829ms 742ms -87ms -1.2 -11.7%
devAutodocsVisible 745ms 727ms -18ms 0.12 -2.5%
devMDXVisible 677ms 708ms 31ms -0.12 4.4%
buildManagerHeaderVisible 791ms 740ms -51ms -0.18 -6.9%
buildManagerIndexVisible 793ms 778ms -15ms 0.15 -1.9%
buildStoryVisible 868ms 815ms -53ms 0.04 -6.5%
buildAutodocsVisible 760ms 751ms -9ms 1 -1.2%
buildMDXVisible 952ms 720ms -232ms 0.28 -32.2%

@ndelangen ndelangen self-assigned this Aug 27, 2024
@ndelangen ndelangen added maintenance User-facing maintenance tasks ci:normal labels Aug 27, 2024
@ndelangen ndelangen changed the title Maintenance: Replace lodash with es-toolkit Core: Replace lodash with es-toolkit Aug 27, 2024
Copy link

nx-cloud bot commented Aug 27, 2024

☁️ Nx Cloud Report

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

Base automatically changed from norbert/babel-dedup-core to next August 27, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:normal maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Tracking]: Replace Lodash Usage with Native Functionality or Alternatives
1 participant