chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2025-07-10 18:26:31 +02:00
parent a190597905
commit 087e639020
382 changed files with 29496 additions and 2675 deletions

View file

@ -19,8 +19,8 @@ class CompareLayer {
if (!layer.source?.["osmTags"]) {
return
}
layer.tagRenderings = layer.tagRenderings?.filter(tr => tr !== "images") ?? []
if(layer.tagRenderings.length === 0){
layer.tagRenderings = layer.tagRenderings?.filter((tr) => tr !== "images") ?? []
if (layer.tagRenderings.length === 0) {
return
}
if (!candidate) {
@ -38,28 +38,27 @@ class CompareLayer {
if (layer.tagRenderings.length === 0) {
console.log("MINIMAL")
}
console.log("> "+layer.description?.["en"])
console.log("> " + layer.description?.["en"])
}
}
}
class InspectStudioLayers extends Script {
constructor() {
super("Iterates over all the studio layers and tries to match it with an already existing layer and list differences")
super(
"Iterates over all the studio layers and tries to match it with an already existing layer and list differences"
)
}
async main(args: string[]): Promise<void> {
const path = args[0] ?? "/home/pietervdvn/data/mapcomplete-custom-themes"
ScriptUtils.erasableLog = () => {}
const files = ScriptUtils.readDirRecSync(path)
.filter(p => p.endsWith(".json"))
.filter(p => p.indexOf("/themes/") < 0)
.filter(p => !p.endsWith("license_info.json") && p.indexOf(".stversions") < 0)
.filter((p) => p.endsWith(".json"))
.filter((p) => p.indexOf("/themes/") < 0)
.filter((p) => !p.endsWith("license_info.json") && p.indexOf(".stversions") < 0)
const officialFiles = new Map<string, LayerConfigJson>()
const unofficial: { layer: LayerConfigJson, path: string }[] = []
const unofficial: { layer: LayerConfigJson; path: string }[] = []
for (const file of files) {
const rest = file.substring(path.length + 1)
console.log("Loading ", rest)
@ -74,13 +73,18 @@ class InspectStudioLayers extends Script {
console.error("COULD NOT READ/PARSE", file, "ignoring it")
}
}
console.log("Loaded", unofficial.length, "custom layers and ", officialFiles.size, "official layers")
console.log(
"Loaded",
unofficial.length,
"custom layers and ",
officialFiles.size,
"official layers"
)
const comp = new CompareLayer(officialFiles)
for (const layerConfigJson of unofficial) {
await comp.compare(layerConfigJson.layer, layerConfigJson.path)
}
}
}
new InspectStudioLayers().run()