mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
refactor(ids): generate content id unions from the structure documents
scripts/generate-content-types.ts writes the gitignored src/types/content-ids.ts (id unions + project category values) from the four structure documents; wired as generate:ids / predev / prebuild / prepare. src/types/index.ts re-exports them type-only and keeps only the code-owned unions. Edit mode now writes JSON only: the v4 union leg is deleted (saveIdUnions, diffIdsWithUnions, applyUnionChanges, readUnionBlock, the EditBar union card, edit.union.* labels). Validator rule 7 requires a label for every category a project uses, in both ui/projects.json documents. Tests: smoke-draft.ts 11/11 (rename re-sluging + category-label rule replace checks 9-12); new scripts/smoke-generated-ids.ts 7/7. Verified: pnpm build (chunk names unchanged, no runtime reference to the generated module), lint with no new warnings, validate:content, resume HTML byte-identical before/after with identical documents. Docs: spec-v5-generated-content-ids.md added; spec-v4-live-edit.md §3.1 marked superseded + §12 row 23; AGENTS.md and README.md updated.
This commit is contained in:
1 parent
1a1fc14d0e
commit
a3662a9521
18 files changed
+732
-357
No files matched your search
+12
-37
@@ -4,43 +4,18 @@ export type Palette = 'red' | 'blue';
|
||||
|
||||
export type SocialId = 'github' | 'linkedin' | 'email' | 'telegram';
|
||||
|
||||
export type ProjectCategory =
|
||||
| "software-engineering"
|
||||
| "logistics"
|
||||
| "ai-ml"
|
||||
| "computer-vision"
|
||||
| "architecture"
|
||||
| "experiment";
|
||||
|
||||
// Stable id unions (spec-v4 §3.1). Text dictionaries are type-safe only against
|
||||
// closed unions: adding a content item means adding a union member, a structure
|
||||
// record, and its Vietnamese text — tsc catches a missing text entry, the
|
||||
// validator (src/i18n/validate.ts) catches id mismatches across documents.
|
||||
// SkillGroupId and PhilosophyId are internal keys and never appear in URLs.
|
||||
export type ProjectId =
|
||||
| 'iot-dws-integration'
|
||||
| 'awb-detection';
|
||||
|
||||
export type ExperienceId =
|
||||
| 'open-to-work'
|
||||
| 'relax-gap'
|
||||
| 'lazada-senior-swe'
|
||||
| 'nexts-founder'
|
||||
| 'sap-senior-swe';
|
||||
|
||||
export type SkillGroupId =
|
||||
| 'software-engineering'
|
||||
| 'system-architecture'
|
||||
| 'ai-ml'
|
||||
| 'infrastructure'
|
||||
| 'engineering-practices';
|
||||
|
||||
export type PhilosophyId =
|
||||
| 'build-for-the-real-problem'
|
||||
| 'think-in-systems'
|
||||
| 'measure-impact'
|
||||
| 'keep-learning'
|
||||
| 'business-domain-knowledge-is-a-key-of-success';
|
||||
// Content ids and the category values a project uses are generated from the
|
||||
// structure documents by scripts/generate-content-types.ts (spec-v5): the union
|
||||
// is exactly the document, so a record delete cannot leave a stale member and a
|
||||
// text entry for it is a tsc error. Type-only re-export — erased at emit, no
|
||||
// runtime import.
|
||||
export type {
|
||||
ExperienceId,
|
||||
PhilosophyId,
|
||||
ProjectCategory,
|
||||
ProjectId,
|
||||
SkillGroupId,
|
||||
} from './content-ids';
|
||||
|
||||
// Page manifests (spec-v4-data-organization §5): one per route plus the
|
||||
// synthetic resume consumer. A manifest claims which joined records a page
|
||||
|
||||
Reference in new issue
Block a user