NodeJS script to convert country flags SVG files named by their country, to react components named by each country code.
- nodejs + npm installed
- svgr cli installed globally
npm install @svgr/cli -g
> npm i
> node index.js
output will be under output
folder
flags --> SVG files, named by "flag-<country-name>.svg"
countries_data --> JSON files that map country code to country name
|__ countries.json --> ensured mapping.
|__ external_countries.json --> mapping from external sources, shouldn't be 100% trusted.
configs
|__ config.json --> react components prettier configs
|__ template.js --> template for creating a react component JS file for each SVG file
output
|__ flags --> all react components
|__ index.js --> all react components exported by their country code
utils --> utils.. basically all the logic sits there