Attempt to fix build

This commit is contained in:
Pieter Vander Vennet 2024-03-12 23:35:07 +01:00
parent 7a37044a48
commit cd9634a67b

View file

@ -40,6 +40,26 @@ export class GenerateFavouritesLayer extends Script {
} }
} }
async main(args: string[]): Promise<void> {
console.log("Generating the favourite layer: stealing _all_ tagRenderings")
const proto = this.readLayer("favourite/favourite.proto.json")
this.addTagRenderings(proto)
this.addTitle(proto)
proto.titleIcons = this.generateTitleIcons()
const targetContent = JSON.stringify(proto, null, " ")
const path = "./assets/layers/favourite/favourite.json"
if (existsSync(path)) {
if (readFileSync(path, "utf8") === targetContent) {
console.log(
"Already existing favourite layer is identical to the generated one, not writing"
)
return
}
}
console.log("Written favourite layer to", path)
writeFileSync(path, targetContent)
}
private sortMappings(mappings: MappingConfigJson[]): MappingConfigJson[] { private sortMappings(mappings: MappingConfigJson[]): MappingConfigJson[] {
const sortedMappings: MappingConfigJson[] = [...mappings] const sortedMappings: MappingConfigJson[] = [...mappings]
sortedMappings.sort((a, b) => { sortedMappings.sort((a, b) => {
@ -200,6 +220,10 @@ export class GenerateFavouritesLayer extends Script {
if (titleIcon["labels"]?.indexOf("defaults") >= 0) { if (titleIcon["labels"]?.indexOf("defaults") >= 0) {
continue continue
} }
if (titleIcon.id === "iconsdefaults") {
continue
}
if (titleIcon.id === "rating") { if (titleIcon.id === "rating") {
if (!seenTitleIcons.has("rating")) { if (!seenTitleIcons.has("rating")) {
titleIcons.unshift(...iconsLibrary.get("rating")) titleIcons.unshift(...iconsLibrary.get("rating"))
@ -302,26 +326,6 @@ export class GenerateFavouritesLayer extends Script {
} }
} }
async main(args: string[]): Promise<void> {
console.log("Generating the favourite layer: stealing _all_ tagRenderings")
const proto = this.readLayer("favourite/favourite.proto.json")
this.addTagRenderings(proto)
this.addTitle(proto)
proto.titleIcons = this.generateTitleIcons()
const targetContent = JSON.stringify(proto, null, " ")
const path = "./assets/layers/favourite/favourite.json"
if (existsSync(path)) {
if (readFileSync(path, "utf8") === targetContent) {
console.log(
"Already existing favourite layer is identical to the generated one, not writing"
)
return
}
}
console.log("Written favourite layer to", path)
writeFileSync(path, targetContent)
}
private readLayer(path: string): LayerConfigJson { private readLayer(path: string): LayerConfigJson {
try { try {
return JSON.parse(readFileSync("./assets/layers/" + path, "utf8")) return JSON.parse(readFileSync("./assets/layers/" + path, "utf8"))