chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2025-06-16 14:46:12 +02:00
parent d3dc1ac4c0
commit b4efa38c06
96 changed files with 3045 additions and 2849 deletions

View file

@ -162,9 +162,7 @@ class GenerateLayouts extends Script {
return path
}
async createManifest(
layout: ThemeConfig
): Promise<{
async createManifest(layout: ThemeConfig): Promise<{
manifest: any
whiteIcons: string[]
}> {
@ -443,11 +441,7 @@ class GenerateLayouts extends Script {
return [`<meta http-equiv="Content-Security-Policy" content="${content}">`].join("\n")
}
async createLandingPage(
layout: ThemeConfig,
layoutJson: ThemeConfigJson,
whiteIcons
) {
async createLandingPage(layout: ThemeConfig, layoutJson: ThemeConfigJson, whiteIcons) {
Locale.language.setData(layout.language[0])
const targetLanguage = layout.language[0]
const ogTitle = Translations.T(layout.title).textFor(targetLanguage).replace(/"/g, '\\"')
@ -624,11 +618,7 @@ class GenerateLayouts extends Script {
writeFile("public/" + manifestLocation, manif, err)
// Create a landing page for the given theme
const landing = await this.createLandingPage(
layout,
layoutConfigJson,
whiteIcons
)
const landing = await this.createLandingPage(layout, layoutConfigJson, whiteIcons)
writeFile(this.enc(layout.id) + ".html", landing, err)
await this.createIndexFor(layout)
@ -660,11 +650,12 @@ class GenerateLayouts extends Script {
console.warn("Only generating layout " + theme)
}
const paths = ScriptUtils.readDirRecSync("./public/assets/generated/themes/", 1)
const configs = paths.map(path => <ThemeConfigJson>JSON.parse(readFileSync(path, "utf8")))
const configsFiltered = configs
.filter(config => (theme !== undefined && config.id === theme) || !blacklist.has(config.id))
const configs = paths.map((path) => <ThemeConfigJson>JSON.parse(readFileSync(path, "utf8")))
const configsFiltered = configs.filter(
(config) => (theme !== undefined && config.id === theme) || !blacklist.has(config.id)
)
await Promise.all(configsFiltered.map(config => this.createThemeFor(config)))
await Promise.all(configsFiltered.map((config) => this.createThemeFor(config)))
const { manifest } = await this.createManifest(
new ThemeConfig({