()
| 184 | /** Create the themes dir on first run (seeding Soft Paper + README), and migrate |
| 185 | * any leftover `*.toml` palette files from the pre-release WIP. */ |
| 186 | export async function ensureCustomThemesDir(): Promise<string> { |
| 187 | const dir = getCustomThemesDir() |
| 188 | let existed = true |
| 189 | try { |
| 190 | await fs.access(dir) |
| 191 | } catch { |
| 192 | existed = false |
| 193 | } |
| 194 | await fs.mkdir(dir, { recursive: true }) |
| 195 | await migrateTomlThemes(dir) |
| 196 | if (!existed) { |
| 197 | await writeThemeFolder( |
| 198 | dir, |
| 199 | 'soft-paper', |
| 200 | softPaperManifest(), |
| 201 | scaffoldThemeCss({ |
| 202 | name: 'Soft Paper', |
| 203 | slug: 'soft-paper', |
| 204 | light: SOFT_PAPER_LIGHT, |
| 205 | dark: SOFT_PAPER_DARK |
| 206 | }) |
| 207 | ).catch(() => {}) |
| 208 | await fs.writeFile(path.join(dir, 'README.md'), README).catch(() => {}) |
| 209 | } else { |
| 210 | await refreshStaleReadme(dir) |
| 211 | } |
| 212 | return dir |
| 213 | } |
| 214 | |
| 215 | /** Replace a pre-CSS-format README (the retired `.toml` palette docs) in place so |
| 216 | * upgrading users don't read instructions for a format that no longer works. |
no test coverage detected