feat: M0 monorepo skeleton with services, clients, deploy and CI
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
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
- 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>
This commit is contained in:
1 parent
9eb1c25147
commit
ebf296542c
98 files changed
+12130
-4
No files matched your search
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"app": {
|
||||
"name": "pipu",
|
||||
"tagline": "Your music from your own server"
|
||||
},
|
||||
"server": {
|
||||
"title": "Server",
|
||||
"checking": "Checking the server…",
|
||||
"online": "Server {{version}} is online",
|
||||
"offline": "The server is not responding. Check the address and your network.",
|
||||
"address": "Server address",
|
||||
"check": "Check",
|
||||
"invalid_address": "Enter the server address, e.g. https://music.home.lan",
|
||||
"unsupported_app": "This app version is too old for the server — please update the app"
|
||||
},
|
||||
"language": {
|
||||
"label": "Language",
|
||||
"ru": "Русский",
|
||||
"en": "English"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"app": {
|
||||
"name": "pipu",
|
||||
"tagline": "Ваша музыка с вашего сервера"
|
||||
},
|
||||
"server": {
|
||||
"title": "Сервер",
|
||||
"checking": "Проверяем сервер…",
|
||||
"online": "Сервер {{version}} на связи",
|
||||
"offline": "Сервер не отвечает. Проверьте адрес и сеть.",
|
||||
"address": "Адрес сервера",
|
||||
"check": "Проверить",
|
||||
"invalid_address": "Введите адрес сервера, например https://music.home.lan",
|
||||
"unsupported_app": "Эта версия приложения слишком старая для сервера — обновите приложение"
|
||||
},
|
||||
"language": {
|
||||
"label": "Язык",
|
||||
"ru": "Русский",
|
||||
"en": "English"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "@pipu/i18n",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"exports": { ".": "./src/index.ts" },
|
||||
"scripts": {
|
||||
"check": "node scripts/check.mjs",
|
||||
"test": "node scripts/check.mjs",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"i18next": "^25.2.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Проверяет словари: одинаковые ключи во всех языках и совпадение плейсхолдеров {{...}}.
|
||||
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} языка — ок`);
|
||||
@@ -0,0 +1,47 @@
|
||||
import i18next, { type i18n as I18n } from 'i18next';
|
||||
|
||||
import enCommon from '../locales/en/common.json';
|
||||
import ruCommon from '../locales/ru/common.json';
|
||||
|
||||
/** Поддерживаемые языки. Новый язык = папка в locales/ + строка здесь. */
|
||||
export const SUPPORTED_LOCALES = ['ru', 'en'] as const;
|
||||
export type Locale = (typeof SUPPORTED_LOCALES)[number];
|
||||
export const DEFAULT_LOCALE: Locale = 'en';
|
||||
|
||||
export const resources = {
|
||||
ru: { common: ruCommon },
|
||||
en: { common: enCommon },
|
||||
} as const;
|
||||
|
||||
declare module 'i18next' {
|
||||
interface CustomTypeOptions {
|
||||
defaultNS: 'common';
|
||||
resources: (typeof resources)['ru'];
|
||||
}
|
||||
}
|
||||
|
||||
/** Выбирает поддерживаемый язык из списка предпочтений (navigator.languages, настройки ОС). */
|
||||
export function pickLocale(preferred: readonly string[]): Locale {
|
||||
for (const tag of preferred) {
|
||||
const base = tag.toLowerCase().split('-')[0];
|
||||
const match = SUPPORTED_LOCALES.find((l) => l === base);
|
||||
if (match) return match;
|
||||
}
|
||||
return DEFAULT_LOCALE;
|
||||
}
|
||||
|
||||
/** Создаёт и инициализирует экземпляр i18next. */
|
||||
export async function createI18n(locale: Locale): Promise<I18n> {
|
||||
const instance = i18next.createInstance();
|
||||
await instance.init({
|
||||
lng: locale,
|
||||
fallbackLng: DEFAULT_LOCALE,
|
||||
supportedLngs: [...SUPPORTED_LOCALES],
|
||||
defaultNS: 'common',
|
||||
ns: ['common'],
|
||||
resources,
|
||||
interpolation: { escapeValue: false },
|
||||
returnNull: false,
|
||||
});
|
||||
return instance;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../../tsconfig.base.json", "include": ["src", "locales"] }
|
||||
Reference in new issue
Block a user