feat(irpc): demonstrate documented international credit in QA
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-27 14:57:18 +02:00
parent 814fe0a9b7
commit 838ad941a2
17 changed files with 734 additions and 16 deletions
+11
View File
@@ -0,0 +1,11 @@
import fs from 'node:fs';
import crypto from 'node:crypto';
const source = new URL('../resources/data/iso3166.tab', import.meta.url);
const text = fs.readFileSync(source, 'utf8').replace(/\r\n/g, '\n');
const codes = text.split('\n').filter(line => line && !line.startsWith('#')).map(line => line.split('\t')[0]);
if (new Set(codes).size !== codes.length || codes.some(code => !/^[A-Z]{2}$/.test(code))) throw Error('Invalid existing ISO catalogue');
const hash = crypto.createHash('sha256').update(text).digest('hex');
fs.writeFileSync(new URL('../resources/js/lib/country-iso-codes.ts', import.meta.url),
'// Derived code projection of resources/data/iso3166.tab; keep the existing PHP catalogue authoritative.\n' +
'// Source SHA256 (LF): ' + hash + '; regenerate with node tools/country-iso-projection.mjs\n' +
"export const countryIsoCodes = '" + codes.join(' ') + "'.split(' ');\n");