DUNGEONS-34: implement Webka local streaming app

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-09-06 16:23:09 +05:00
parent 5540b9a1f4
commit 7c737c1011
36 changed files with 21596 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import { readFileSync, readdirSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { join } from "node:path";
const root = fileURLToPath(new URL("../", import.meta.url));
const flatten = (value, prefix = "") =>
Object.entries(value).flatMap(([key, v]) =>
typeof v === "object"
? flatten(v, `${prefix}${key}.`)
: [`${prefix}${key}`],
);
const locales = ["en", "ru", "es"].map((code) =>
JSON.parse(readFileSync(join(root, `i18n/locales/${code}.json`), "utf8")),
);
const expected = flatten(locales[0]).sort();
for (let i = 1; i < locales.length; i++)
if (JSON.stringify(flatten(locales[i]).sort()) !== JSON.stringify(expected))
throw Error("Locale key mismatch");
const files = (path) =>
readdirSync(path, { withFileTypes: true }).flatMap((entry) =>
entry.isDirectory()
? files(join(path, entry.name))
: [join(path, entry.name)],
);
for (const file of [
...files(join(root, "pages")),
...files(join(root, "components")),
join(root, "app.vue"),
]) {
for (const match of readFileSync(file, "utf8").matchAll(
/\b(?:\$t|t)\(['"]([\w.]+)['"]/g,
))
if (!expected.includes(match[1]))
throw Error(`${file}: Missing ${match[1]}`);
}
console.log(
`${expected.length} keys match in en/ru/es; static template keys verified.`,
);