Added flags to Geo.

This commit is contained in:
Niels Simenon 2022-11-06 16:14:14 +01:00
parent e0aab6acf3
commit 4727217b88
510 changed files with 1554 additions and 14 deletions

View File

@ -8,7 +8,11 @@ const { argv } = require('yargs');
const countries = require('./countries.json');
const states = require('./states-us.json');
const data = { countries, states };
const data = {
countries,
states,
flags: countries,
};
/*
async function fetchCountries() {
@ -26,13 +30,18 @@ async function fetchCountries() {
*/
async function init() {
const type = argv.states ? 'states' : 'countries';
const type = argv.type || 'countries';
const countryImgs = await fs.readdir(`./assets/${type}`);
const countriesByCode = Object.fromEntries(data[type].map((country) => [country.alpha2, country]));
const imgCountries = await Promise.all(countryImgs.filter((file) => !['encoded', 'disabled'].includes(file)).map(async (file) => {
const code = file.match(/(\w+).png/)[1];
const imgCountries = await Promise.all(countryImgs.map(async (file) => {
const code = file.match(/(\w+).png/)?.[1];
if (!code || !countriesByCode[code]) {
return null;
}
const filename = `${crypto.createHash('md5').update(code).digest('hex').slice(0, 4)}.png`;
await fs.copyFile(`./assets/${type}/${file}`, `./assets/${type}/encoded/${filename}`);
@ -42,7 +51,7 @@ async function init() {
code,
...countriesByCode[code],
};
}));
}).filter(Boolean));
await fs.writeFile(`./assets/${type}-curated.json`, JSON.stringify(imgCountries, null, 4));

View File

@ -1222,12 +1222,14 @@
{
"alpha2": "VG",
"code": 92,
"name": "Virgin Islands (UK)"
"name": "Virgin Islands",
"fullName": "Virgin Islands (UK)"
},
{
"alpha2": "VI",
"code": 850,
"name": "Virgin Islands (US)"
"name": "Virgin Islands",
"fullName": "Virgin Islands (US)"
},
{
"alpha2": "WF",

1514
assets/flags-curated.json Normal file

File diff suppressed because it is too large Load Diff

BIN
assets/flags/AD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
assets/flags/AE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

BIN
assets/flags/AF.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
assets/flags/AG.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
assets/flags/AI.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
assets/flags/AL.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
assets/flags/AM.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

BIN
assets/flags/AO.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
assets/flags/AQ.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
assets/flags/AR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
assets/flags/AS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
assets/flags/AT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

BIN
assets/flags/AU.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
assets/flags/AW.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
assets/flags/AX.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
assets/flags/AZ.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
assets/flags/BA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
assets/flags/BB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
assets/flags/BD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
assets/flags/BE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

BIN
assets/flags/BF.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
assets/flags/BG.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

BIN
assets/flags/BH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
assets/flags/BI.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
assets/flags/BJ.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 787 B

BIN
assets/flags/BL.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

BIN
assets/flags/BM.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
assets/flags/BN.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
assets/flags/BO.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
assets/flags/BQ.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

BIN
assets/flags/BR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
assets/flags/BS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
assets/flags/BT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
assets/flags/BV.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
assets/flags/BW.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

BIN
assets/flags/BY.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
assets/flags/BZ.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
assets/flags/CA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
assets/flags/CC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
assets/flags/CD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
assets/flags/CF.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
assets/flags/CG.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
assets/flags/CH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

BIN
assets/flags/CI.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

BIN
assets/flags/CK.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
assets/flags/CL.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
assets/flags/CM.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
assets/flags/CN.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
assets/flags/CO.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

BIN
assets/flags/CR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 B

BIN
assets/flags/CU.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
assets/flags/CV.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
assets/flags/CW.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
assets/flags/CX.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
assets/flags/CY.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
assets/flags/CZ.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
assets/flags/DE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

BIN
assets/flags/DJ.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
assets/flags/DK.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

BIN
assets/flags/DM.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
assets/flags/DO.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
assets/flags/DZ.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
assets/flags/EC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
assets/flags/EE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 B

BIN
assets/flags/EG.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
assets/flags/EH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

BIN
assets/flags/ER.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
assets/flags/ES-CT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 657 B

BIN
assets/flags/ES.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
assets/flags/ET.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
assets/flags/EU.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
assets/flags/FI.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
assets/flags/FJ.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
assets/flags/FK.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
assets/flags/FM.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
assets/flags/FO.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
assets/flags/FR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

BIN
assets/flags/GA.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

BIN
assets/flags/GB-ENG.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

BIN
assets/flags/GB-NIR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
assets/flags/GB-SCT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
assets/flags/GB-WLS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
assets/flags/GB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
assets/flags/GD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
assets/flags/GE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
assets/flags/GF.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
assets/flags/GG.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
assets/flags/GH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
assets/flags/GI.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
assets/flags/GL.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
assets/flags/GM.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

BIN
assets/flags/GN.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

BIN
assets/flags/GP.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

BIN
assets/flags/GQ.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
assets/flags/GR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
assets/flags/GS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
assets/flags/GT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Some files were not shown because too many files have changed in this diff Show More