From 376bc18b88957f338f16cd4419fd3e3faff0aeed Mon Sep 17 00:00:00 2001 From: Lenni009 Date: Sun, 24 Sep 2023 13:55:43 +0200 Subject: [PATCH] bump version --- deno.json | 3 +++ main.ts | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/deno.json b/deno.json index 295dfd5..d0c7d92 100644 --- a/deno.json +++ b/deno.json @@ -2,5 +2,8 @@ "tasks": { "run": "deno run --allow-read --allow-write main.ts", "build": "deno compile --allow-read --allow-write main.ts" + }, + "imports": { + "flags": "https://deno.land/std@0.202.0/flags/mod.ts" } } \ No newline at end of file diff --git a/main.ts b/main.ts index fd1fa0a..c614d1a 100644 --- a/main.ts +++ b/main.ts @@ -1,7 +1,7 @@ // import packages import { XMLParser } from "npm:fast-xml-parser"; import { decode } from "npm:html-entities"; -import { parse } from "https://deno.land/std@0.178.0/flags/mod.ts"; +import { parse } from "flags"; // get CLI args const args = parse(Deno.args); @@ -89,14 +89,15 @@ for (let i = 0; i < files.length; i++) { langData[langKey] ??= {}; continue; } - const langValue = entry.Property!['@value']; + if (!entry?.Property) continue; + const langValue = entry.Property['@value']; if (!langValue) continue; const language = entry['@name']; if (languageArgs.length && !languageArgs.includes(language.toLowerCase())) continue; - langData[langKey!][language] = decode(langValue, { level: 'xml' }); + langData[langKey!][language] = decode(langValue, { level: 'xml' }); // NoSonar this is necessary, for some reason TS complains here :shrug: } } - console.log(`${i + 1} / ${files.length} (${Math.round(((i + 1) / files.length) * 100)}%) - Processed ${fullFileName}`); + console.log(`${i + 1} / ${files.length} (${Math.round(((i + 1) / files.length) * 100)}%) - Processed ${fullFileName}`); // NoSonar this is just percentage calculation } const textContent = []; for (const key in langData) {