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

feat: replace lodash with ramda #1242

Merged
merged 8 commits into from
Sep 13, 2023
Merged

Conversation

danielbate
Copy link
Contributor

This work is instigated by the efforts to support browser testing, specifically regarding Vitest. The version of lodash we use does not export for ESM. This PR looks to swap out lodash for ramda, which exports both CJS and ESM.

Relates to #284 and specifically this comment.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2023

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements
84.41% (-0.02% 🔻)
4943/5856
🟡 Branches
65.56% (-0.09% 🔻)
750/1144
🟡 Functions
73.89% (+0.02% 🔼)
832/1126
🟢 Lines
84.48% (-0.02% 🔻)
4721/5588
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / normalizeString.ts
93.75% (-6.25% 🔻)
0% (-100% 🔻)
100%
92.31% (-7.69% 🔻)

Test suite run success

1198 tests passing in 207 suites.

Report generated by 🧪jest coverage report action from 6016ea7

Copy link
Contributor

@Torres-ssf Torres-ssf left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@Dhaiwat10 Dhaiwat10 left a comment

Choose a reason for hiding this comment

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

LGTM mate. Btw, do you think it would be a better idea to merge this PR into the browser testing PR's branch instead of master?

Copy link
Contributor

@camsjams camsjams left a comment

Choose a reason for hiding this comment

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

Looks good. Does Ramda work with treeshaking? The lodash packages here were two tiny subsets of lodash. Most modern JS only imports the code being utilized.

I'm assuming yes, but can we double-check?

@danielbate
Copy link
Contributor Author

@Dhaiwat10 I can get a topic branch going if that is preferred, however I as part of this work I will also be upgrading other packages. For example, ethers v5 -> v6 as that bring ES support, which I think would be good to have on master to keep us up to date, rather than being directly tied to the browser compatibility work.

@danielbate
Copy link
Contributor Author

@camsjams Ramda has supported tree-shaking since v0.25.0, however I believe it depends more on our tsup configuration, I'll compare bundle sizes and will report back.

@danielbate
Copy link
Contributor Author

@camsjams the bundle size actually looks to be smaller with ramda so yes definitely some smart bundling happening, therefore I am going to merge this PR.

Master:

ESM dist/index.mjs     883.00 B
ESM dist/cli.mjs       684.00 B
ESM dist/bin.mjs       721.00 B
ESM dist/index.mjs.map 1.12 KB
ESM dist/cli.mjs.map   1.16 KB
ESM dist/bin.mjs.map   1.28 KB
ESM ⚡️ Build success in 10ms
CJS dist/bin.js       761.00 B
CJS dist/index.js     3.49 KB
CJS dist/cli.js       1.66 KB
CJS dist/bin.js.map   1.31 KB
CJS dist/cli.js.map   1.24 KB
CJS dist/index.js.map 1.32 KB
CJS ⚡️ Build success in 10ms
IIFE dist/bin.global.js       871.63 KB
IIFE dist/cli.global.js       871.58 KB
IIFE dist/index.global.js     1.94 MB
IIFE dist/cli.global.js.map   1.50 MB
IIFE dist/bin.global.js.map   1.50 MB
IIFE dist/index.global.js.map 3.48 MB

w/ Ramda:

ESM dist/bin.mjs       721.00 B
ESM dist/cli.mjs       684.00 B
ESM dist/index.mjs     883.00 B
ESM dist/index.mjs.map 1.12 KB
ESM dist/cli.mjs.map   1.16 KB
ESM dist/bin.mjs.map   1.28 KB
ESM ⚡️ Build success in 11ms
CJS dist/index.js     3.49 KB
CJS dist/cli.js       1.66 KB
CJS dist/bin.js       761.00 B
CJS dist/index.js.map 1.32 KB
CJS dist/bin.js.map   1.31 KB
CJS dist/cli.js.map   1.24 KB
CJS ⚡️ Build success in 11ms
IIFE dist/bin.global.js       873.39 KB
IIFE dist/cli.global.js       873.34 KB
IIFE dist/index.global.js     1.92 MB
IIFE dist/bin.global.js.map   1.49 MB
IIFE dist/cli.global.js.map   1.49 MB
IIFE dist/index.global.js.map 3.42 MB

@danielbate danielbate merged commit 6c22b7c into master Sep 13, 2023
8 checks passed
@danielbate danielbate deleted the db/feat/replace-lodash-with-ramda branch September 13, 2023 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants