()
| 34 | let settingsCache: Settings | undefined |
| 35 | |
| 36 | async function loadSettings(): Promise<Settings> { |
| 37 | if (settingsCache) return settingsCache |
| 38 | const file = Bun.file(settingsFile) |
| 39 | const exists = await file.exists() |
| 40 | if (!exists) { |
| 41 | settingsCache = {} |
| 42 | return settingsCache |
| 43 | } |
| 44 | settingsCache = await file.json().catch(() => ({})) |
| 45 | return settingsCache! |
| 46 | } |
| 47 | |
| 48 | async function saveSettings(settings: Settings): Promise<void> { |
| 49 | settingsCache = settings |
no test coverage detected