Attempt to fix build

This commit is contained in:
Pieter Vander Vennet 2023-12-06 12:12:53 +01:00
parent 259d4d7fdf
commit 42a87d2611
5 changed files with 592 additions and 110 deletions

View file

@ -19,7 +19,7 @@ import ValidationUtils from "../src/Models/ThemeConfig/Conversion/ValidationUtil
const sharp = require("sharp")
const template = readFileSync("theme.html", "utf8")
const codeTemplate = readFileSync("src/index_theme.ts.template", "utf8")
let codeTemplate = readFileSync("src/index_theme.ts.template", "utf8")
function enc(str: string): string {
return encodeURIComponent(str.toLowerCase())
@ -487,8 +487,19 @@ async function createIndexFor(theme: LayoutConfig) {
`import layout from "./src/assets/generated/themes/${theme.id}.json"`,
`import { ThemeMetaTagging } from "./src/assets/generated/metatagging/${theme.id}"`,
]
for (const layerName of Constants.added_by_default) {
imports.push(`import ${layerName} from "./src/assets/generated/layers/${layerName}.json"`)
}
writeFileSync(filename, imports.join("\n") + "\n")
const addLayers = []
for (const layerName of Constants.added_by_default) {
addLayers.push(` layout.layers.push(<any> ${layerName})`)
}
codeTemplate = codeTemplate.replace(" // LAYOUT.ADD_LAYERS", addLayers.join("\n"))
appendFileSync(filename, codeTemplate)
}