Files
pipu-music/packages/i18n/scripts/check.mjs
T
mrleo1nidandClaude Opus 5.5 ebf296542c
ci / contract (сгенерированный код совпадает с openapi.yaml) (push) Successful in 3m55s
ci / api (push) Successful in 51s
ci / mobile (Metro-бандл Android) (push) Canceled after 0s
release / images (services/api/Dockerfile, storage-agent, storage-agent) (push) Canceled after 0s
release / images (services/recommender/Dockerfile, recommender, ) (push) Canceled after 0s
ci / recommender (push) Successful in 1m11s
ci / ts (packages + web) (push) Canceled after 3s
release / verify (push) Successful in 1m16s
release / images (apps/web/Dockerfile, web, ) (push) Failing after 2m40s
release / android + release (push) Skipped
release / images (services/api/Dockerfile, api, api) (push) Canceled after 1s
feat: M0 monorepo skeleton with services, clients, deploy and CI
- api/openapi.yaml: contract with /healthz, /readyz, /api/v1/server-info
- services/api (Go): api with oapi-codegen strict server, goose migrations,
  readiness checks for Postgres/Redis; storage-agent stub with internal token
- services/recommender (Python, uv): FastAPI health/readiness/internal status,
  `pipu-rec serve` and `pipu-rec analyze` entrypoints
- packages: generated api-client, core (server URL + server check),
  i18n (ru/en + dictionary check), design-tokens (CSS vars + TS from tokens.json)
- apps/web: Vite + React shell showing server status, language switch
- apps/mobile: Expo (SDK 53) Android app with server connect screen
- deploy: Dockerfiles, compose (prod + dev), nginx template, install/update scripts
- .gitea/workflows: ci.yml and tag-based release.yml (images, signed APK, release)
- scripts/version.mjs: version and Android versionCode from git tag
- tests/fixtures/music/generate.sh: synthetic test library via ffmpeg
- docs: versionCode formula, OpenAPI 3.0.3, dev instructions in README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 23:55:11 +03:00

38 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Проверяет словари: одинаковые ключи во всех языках и совпадение плейсхолдеров {{...}}.
import { readdirSync, readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const dir = join(dirname(fileURLToPath(import.meta.url)), '..', 'locales');
const locales = readdirSync(dir);
const flat = (obj, prefix = '') =>
Object.entries(obj).flatMap(([k, v]) =>
typeof v === 'object' ? flat(v, `${prefix}${k}.`) : [[`${prefix}${k}`, String(v)]],
);
const placeholders = (s) => [...s.matchAll(/\{\{\s*(\w+)\s*\}\}/g)].map((m) => m[1]).sort().join(',');
const data = {};
for (const loc of locales) {
for (const file of readdirSync(join(dir, loc))) {
const ns = file.replace(/\.json$/, '');
for (const [k, v] of flat(JSON.parse(readFileSync(join(dir, loc, file), 'utf8')))) {
(data[`${ns}:${k}`] ??= {})[loc] = v;
}
}
}
const errors = [];
for (const [key, byLoc] of Object.entries(data)) {
for (const loc of locales) {
if (!(loc in byLoc)) errors.push(`${loc}: отсутствует ключ ${key}`);
}
const sets = new Set(Object.values(byLoc).map(placeholders));
if (sets.size > 1) errors.push(`${key}: плейсхолдеры различаются между языками`);
}
if (errors.length) {
console.error(errors.join('\n'));
process.exit(1);
}
console.log(`i18n: ${Object.keys(data).length} ключей × ${locales.length} языка — ок`);