-
-
Notifications
You must be signed in to change notification settings - Fork 939
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
refactor(word): reduce definitions to 1000 in all locales #2751
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #2751 +/- ##
==========================================
- Coverage 99.57% 99.50% -0.08%
==========================================
Files 2983 2983
Lines 250340 215303 -35037
Branches 981 984 +3
==========================================
- Hits 249269 214230 -35039
+ Misses 1071 1044 -27
- Partials 0 29 +29
|
Please also enable the script cleanup for the word module here: faker/scripts/generate-locales.ts Line 329 in 776a625
|
That would cause all other locales to be re-sorted so I will do that in a subsequent PR to avoid making the diff too big. |
✅ Deploy Preview for fakerjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Rationale
Follow-on to #2265
Reduced to 1000 entries max in the
words
module definitions in all locales.I selected this module because it had the biggest impact on bundle size (e.g. the
hu
noun file alone is approx 144KB, 10K rows.) while still being relatively easy to review.This is a stepping stone to enabling the
normalizeLocaleFile
for all files (previously I noted that I didn't think it was a good idea to try to enable that for all modules at once, as it introduces massive diffs which are impossible to review, and we might accidentally lose useful information, so currently it's only enabled for new modules likefood
but disabled for existing modules).Even though we dont generally consider editing definitions as semver-major, we may as well make some bundle size improvements in v9 when data is changing anyway as a result of the 53 bit randomizer #2357
Methodology
For any definitions in word module with >1000 entries, I shuffle the array, select 1000 at random and then sort (the sorting is why you see some green in the diffs and not just red)
In total this removes about 530KB from the full bundle.