-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Conversation
lodash
with es-toolkit
lodash
with es-toolkit
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 5a30b77. 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 targetSent with 💌 from NxCloud. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
30 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings
@@ -202,7 +202,7 @@ export function filterTabs(panels: Addon_BaseType[], parameters?: Record<string, | |||
|
|||
if (previewTabs || parametersTabs) { | |||
// deep merge global and local settings | |||
const tabs = merge(previewTabs, parametersTabs); | |||
const tabs = merge(previewTabs || {}, parametersTabs || {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider using nullish coalescing operator (??) for conciseness
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, only a few comments.
Hello! I’m the maintainer of es-toolkit. We’ve fixed camelCase to better support emojis and updated the pick function to ignore nonexistent keys in the original object. Could you give our latest version, v1.21.0, a try? |
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
fores-toolkit
which is mostly a drop-in replacementI've only changed the core for now.
before:
![Screenshot 2024-08-27 at 16 02 20](https://private-user-images.githubusercontent.com/3070389/361837786-b4f2acdb-f717-4e88-8eed-5d3436983d09.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk3NjUzNDEsIm5iZiI6MTczOTc2NTA0MSwicGF0aCI6Ii8zMDcwMzg5LzM2MTgzNzc4Ni1iNGYyYWNkYi1mNzE3LTRlODgtOGVlZC01ZDM0MzY5ODNkMDkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTdUMDQwNDAxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTk3YjZkZDRiMGEyMDhjZWE5ZmYwNmQ1YThmZDRjYmI3ZTI2ZjRiNzQ4NTZkNzMyNWIyMzM1YjllNTA5NmY2YyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.q1wvVdSdkyoVPhB96EdYzvrW9ss_8-st1yMejW8RtgI)
after:
![Screenshot 2024-08-27 at 16 02 26](https://private-user-images.githubusercontent.com/3070389/361837822-aea71158-a00a-4750-9916-b881169c8788.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk3NjUzNDEsIm5iZiI6MTczOTc2NTA0MSwicGF0aCI6Ii8zMDcwMzg5LzM2MTgzNzgyMi1hZWE3MTE1OC1hMDBhLTQ3NTAtOTkxNi1iODgxMTY5Yzg3ODgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTdUMDQwNDAxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NDZiODJkNmIwOTZjOWU2YzNiNDUzMWJkODhmYjI5M2YxYTlmN2I0ZmI3NDg1NDMxMDg4MTM1NzI0Nzk1Nzk2MyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.oU0xemE06bconOq7BhNNVsZIh_G7TsdEd34Kdm4-CME)
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/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>
Greptile Summary
This PR replaces the usage of Lodash with es-toolkit across various files in the Storybook core package, aiming to improve tree-shaking and move towards ESM dependencies.
code/core/package.json
to remove Lodash dependency and add es-toolkitStoryStore.ts
to use es-toolkit functions and introduced a newpicky
function for object property selectionPreviewWeb.test.ts
to use es-toolkit's merge and toMerged functions instead of LodashparseArgsParam.ts
andfilterArgTypes.ts
to use es-toolkit's isPlainObject and pickBy functions respectively