Initial Commit

This commit is contained in:
2026-05-27 23:29:53 +01:00
commit fbc70f96e6
10000 changed files with 1102152 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
# Proposal: @suaveplan/locale-data
## Summary
Add the `@suaveplan/locale-data` package — a static, enterprise-grade locale data library
providing ISO 3166-1 country data and ISO 639-1 language data with typed lookup functions,
OTel instrumentation, and Zod schema validation.
## Motivation
Multiple packages across the monorepo need reliable country and language data (e.g., `@suaveplan/i18n`,
`@suaveplan/domain-normalizer`, future address-validation packages). Centralising this static data
eliminates duplicated definitions and guarantees a single source of truth for ISO codes, native
names, continents, currencies, and RTL language detection.
## Scope
- **countries module**: 209 ISO 3166-1 alpha-2 country entries with name, native name, phone code,
continent, capital, currency, languages, and emoji. Lookup functions: `getCountry`, `getAllCountries`,
`getCountriesByContinent`, `getCountriesByCurrency`.
- **languages module**: ~130 ISO 639-1 language entries with name and native name, plus RTL detection.
Lookup functions: `getLanguage`, `getLanguages`, `getRtlLanguages`, `isRtlLanguage`.
- **errors**: Typed `LocaleDataError` extending `SuaveplanError` with stable code registry.
- **types**: Shared `CountryItem` and `LanguageItem` Zod schemas and inferred types.
- **OTel**: Counters on country/language lookup hits and misses.
## Out of scope
- CLDR data (plural rules, formatting patterns) — covered by `@suaveplan/i18n`
- Flag images / SVG assets
- UN M.49 region codes

View File

@@ -0,0 +1,44 @@
# Tasks: @suaveplan/locale-data
## Task 3.1 — OpenSpec + scaffold ✅
- [x] Create `openspec/changes/enterprise-locale-data/proposal.md` + `tasks.md`
- [x] Scaffold package directory and config files
- [x] `bun install`
- [x] Commit: `chore(locale-data): scaffold package`
## Task 3.2 — Error class + types
- [x] Implement `src/errors/locale-data-error.ts` with `LOCALE_DATA_CODES`
- [x] Create `src/errors/locale-data-error.md`
- [x] Implement `src/types/types.ts` with `CountryItemSchema` and `LanguageItemSchema`
- [x] Create barrels: `src/errors/index.ts`, `src/types/index.ts`
- [x] Commit: `feat(locale-data): add error class and types`
## Task 3.3 — countries module (TDD)
- [x] Write tests in `src/countries/countries.test.ts`
- [x] Run tests → confirm FAIL
- [x] Implement `src/countries/countries.data.ts` (static data)
- [x] Implement `src/countries/countries.ts` (lookup functions + OTel)
- [x] Create `src/countries/countries.schemas.ts` and `countries.md`
- [x] Create `src/countries/index.ts` barrel
- [x] Run tests → confirm PASS
- [x] Commit: `feat(locale-data): add countries module`
## Task 3.4 — languages module (TDD)
- [x] Write tests in `src/languages/languages.test.ts`
- [x] Run tests → confirm FAIL
- [x] Implement `src/languages/languages.data.ts` (static data)
- [x] Implement `src/languages/languages.ts` (lookup functions + OTel)
- [x] Create `src/languages/languages.schemas.ts` and `languages.md`
- [x] Create `src/languages/index.ts` barrel
- [x] Run tests → confirm PASS
- [x] Commit: `feat(locale-data): add languages module`
## Task 3.5 — Docs + pre-publish gate
- [x] Create `README.md`
- [x] `bun run docs:check --filter=@suaveplan/locale-data` → 100%
- [x] `bunx turbo lint typecheck test --filter=@suaveplan/locale-data` → green
- [x] `bunx turbo test:coverage --filter=@suaveplan/locale-data` → 100%
- [x] `bun scripts/publish.ts --package @suaveplan/locale-data`
- [x] Archive openspec changes
- [x] Create `openspec/specs/locale-data/spec.md`
- [x] Commit: `release(locale-data): v0.0.0 — publish to Verdaccio`