MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / refreshStaleReadme

Function refreshStaleReadme

apps/desktop/src/main/custom-themes.ts:218–230  ·  view source on GitHub ↗

Replace a pre-CSS-format README (the retired `.toml` palette docs) in place so * upgrading users don't read instructions for a format that no longer works. * Leaves an already-current or user-written README untouched.

(dir: string)

Source from the content-addressed store, hash-verified

216 * upgrading users don't read instructions for a format that no longer works.
217 * Leaves an already-current or user-written README untouched. */
218async function refreshStaleReadme(dir: string): Promise<void> {
219 const file = path.join(dir, 'README.md')
220 try {
221 const current = await fs.readFile(file, 'utf8')
222 // Old auto-generated READMEs documented `.toml` palettes and never mention
223 // manifest.json — the defining word of the folder format. Refresh only those.
224 if (current !== README && current.includes('.toml') && !current.includes('manifest.json')) {
225 await fs.writeFile(file, README)
226 }
227 } catch {
228 /* missing or unreadable — respect the user's choice and leave it */
229 }
230}
231
232/** Convert each legacy `themes/<slug>.toml` palette to a `themes/<slug>/` folder
233 * (once). The source is renamed `<slug>.toml.migrated` so it isn't re-read or

Callers 1

ensureCustomThemesDirFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected