Add check of valid translations jsons to GA

This commit is contained in:
Kalle 2022-10-29 00:33:07 +03:00
parent 4eb0775532
commit b775d70985
3 changed files with 16 additions and 7 deletions

View File

@ -34,3 +34,5 @@ jobs:
run: npm run lint:styles
- name: Typecheck
run: npm run typecheck
- name: Check translations jsons
run: npm run check-translation-jsons:no-write

View File

@ -19,6 +19,7 @@
"create-misc-json": "node --experimental-specifier-resolution=node --loader ts-node/esm -r tsconfig-paths/register scripts/create-misc-json.ts",
"create-analyzer-json": "node --experimental-specifier-resolution=node --loader ts-node/esm -r tsconfig-paths/register scripts/create-analyzer-json.ts",
"check-translation-jsons": "node --experimental-specifier-resolution=node --loader ts-node/esm -r tsconfig-paths/register scripts/check-translation-jsons.ts && npm run prettier:write-translation-progress",
"check-translation-jsons:no-write": "node --experimental-specifier-resolution=node --loader ts-node/esm -r tsconfig-paths/register scripts/check-translation-jsons.ts --no-write",
"replace-img-names": "node --experimental-specifier-resolution=node --loader ts-node/esm -r tsconfig-paths/register scripts/replace-img-names.ts",
"remove-bad-custom-urls": "node --experimental-specifier-resolution=node --loader ts-node/esm -r tsconfig-paths/register scripts/remove-bad-custom-urls.ts",
"lint:ts": "eslint . --ext .ts,.tsx",

View File

@ -1,8 +1,10 @@
// 1) create status.json
import fs from "fs";
import path from "path";
const NO_WRITE_KEY = "--no-write";
const dontWrite = process.argv.includes(NO_WRITE_KEY);
const otherLanguageTranslationPath = (code?: string, fileName?: string) =>
path.join(
...[__dirname, "..", "public", "locales", code, fileName].filter(
@ -83,13 +85,17 @@ const markdown = createTranslationProgessMarkdown({
totalTranslationCounts,
});
fs.writeFileSync(
path.join(__dirname, "..", "translation-progress.md"),
markdown
);
if (!dontWrite) {
fs.writeFileSync(
path.join(__dirname, "..", "translation-progress.md"),
markdown
);
}
// eslint-disable-next-line no-console
console.log("translation-progress.md written");
console.log(
dontWrite ? "translation-progress.md ok" : "translation-progress.md written"
);
function validateNoExtraKeysInOther({
english,