import fs from "fs"; import path from "path"; const LANG_MAP: Record = { english: "en", italian: "it", german: "de", french: "fr", spanish: "es", }; const POS_MAP: Record = { nouns: "noun", verbs: "verb", adverbs: "adverb", adjectives: "adjective", }; /** * Creates the base JSON file with word, language, and pos. * No logging — the orchestrator handles all console output. */ export function createBaseJson( word: string, outputDir: string, rawLanguage: string, rawPos: string, ): void { const targetFilePath = path.join(outputDir, `${word}.json`); const dbLanguage = LANG_MAP[rawLanguage] || rawLanguage; const dbPos = POS_MAP[rawPos] || rawPos; const initialData = { word, language: dbLanguage, pos: dbPos }; fs.writeFileSync( targetFilePath, JSON.stringify(initialData, null, 2), "utf-8", ); }