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

Use country-list package instead of country_codes.json #225

Merged
merged 3 commits into from
May 17, 2023

Conversation

meisekimiu
Copy link
Member

This PR installs the country-list package as a dependency of web-app and uses it to generate the country list used in various parts of the app. Previously, we just had a big JSON file included in the project. As mentioned in #127, we want to stay away from including this kind of stuff in our project.

Fun fact: We only use the full country name and 2 character country code in the application, but the old country_codes.json file had a lot of other information on each country. The country-list package only has the information we want to use, and as a result it apparently trims down the compiled bundle size by about 55 kilobytes!

Resolves PER-9256. 🇹🇼

@meisekimiu meisekimiu marked this pull request as ready for review May 12, 2023 22:53
Instead of relying on a giant JSON file in our codebase, let's use an
NPM package that provides the dataset instead. This commit installs the
country-list package as a dependency of web-app.

Also install @types/country-list as a dev dependency, since country-list
is a JavaScript library with no type definitions.

PER-9256: Inaccurate names in country list
@meisekimiu meisekimiu force-pushed the remove-country-json branch from 109fb0e to 16b0325 Compare May 15, 2023 16:47
Instead of including a JSON file in our own project, use the
country-list package to get a list of country names and their codes
instead.

The country-list package supplies the overwrite function to allow users
to inject in custom data for specific countries. It is used here to
correct some information that is provided in the default country list.

PER-9256: Inaccurate names in country list
Now that we use the country-list package, we don't need to keep the
country_codes.json file that we were using before. Delete it.

PER-9256: Inaccurate names in country list
@meisekimiu meisekimiu force-pushed the remove-country-json branch from 16b0325 to 34598d3 Compare May 15, 2023 16:49
Copy link
Member

@cecilia-donnelly cecilia-donnelly left a comment

Choose a reason for hiding this comment

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

Thanks, @meisekimiu !

@meisekimiu meisekimiu merged commit 06953a4 into main May 17, 2023
@meisekimiu meisekimiu deleted the remove-country-json branch May 17, 2023 14:27
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.

3 participants