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

Function ensureCustomThemesDir

apps/desktop/src/main/custom-themes.ts:186–213  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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. */
186export 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.

Callers 4

index.tsFile · 0.90
createCustomThemeFunction · 0.85
customThemeRevealTargetFunction · 0.85

Calls 6

scaffoldThemeCssFunction · 0.90
getCustomThemesDirFunction · 0.85
migrateTomlThemesFunction · 0.85
writeThemeFolderFunction · 0.85
softPaperManifestFunction · 0.85
refreshStaleReadmeFunction · 0.85

Tested by

no test coverage detected