MCPcopy Create free account
hub / github.com/FirefoxCSS-Store/FirefoxCSS-Store.github.io / refreshTheme

Function refreshTheme

scripts/refresh-theme-stats.mjs:9–15  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

7const themesDir = path.join(root, 'src/content/themes')
8
9async function refreshTheme(file) {
10 const filePath = path.join(themesDir, file)
11 const theme = JSON.parse(await fs.readFile(filePath, 'utf8'))
12 theme.stats = { ...theme.stats, ...await fetchRepositoryStats(theme.repository, theme.stats) }
13 await fs.writeFile(filePath, `${JSON.stringify(theme, null, 2)}\n`)
14 console.log(`Refreshed ${theme.slug}`)
15}
16
17const files = (await fs.readdir(themesDir)).filter((file) => file.endsWith('.json')).sort()
18

Callers 1

Calls 1

fetchRepositoryStatsFunction · 0.90

Tested by

no test coverage detected