Add check for possible duplicate filters, consolidate duplicate filters

This commit is contained in:
Pieter Vander Vennet 2022-09-24 03:33:09 +02:00
parent f0c7c65d8d
commit dadba86faf
9 changed files with 236 additions and 154 deletions

View file

@ -5,6 +5,7 @@ import { LayoutConfigJson } from "../Models/ThemeConfig/Json/LayoutConfigJson"
import { LayerConfigJson } from "../Models/ThemeConfig/Json/LayerConfigJson"
import Constants from "../Models/Constants"
import {
DetectDuplicateFilters,
DoesImageExist,
PrevalidateTheme,
ValidateLayer,
@ -21,6 +22,7 @@ import { PrepareTheme } from "../Models/ThemeConfig/Conversion/PrepareTheme"
import { DesugaringContext } from "../Models/ThemeConfig/Conversion/Conversion"
import { Utils } from "../Utils"
import { AllKnownLayouts } from "../Customizations/AllKnownLayouts"
import {Script} from "vm";
// This scripts scans 'assets/layers/*.json' for layer definition files and 'assets/themes/*.json' for theme definition files.
// It spits out an overview of those to be used to load them
@ -202,10 +204,15 @@ class LayerOverviewUtils {
"assets/SocialImageTemplateWide.svg",
"assets/SocialImageBanner.svg",
"assets/svg/osm-logo.svg",
"assets/templates/"
"assets/templates/*"
]
for (const path of allSvgs) {
if (exempt.some((p) => "./" + p === path)) {
if (exempt.some((p) => {
if(p.endsWith("*") && path.startsWith("./"+p.substring(0, p.length - 1))){
return true
}
return "./" + p === path;
})) {
continue
}
@ -289,6 +296,11 @@ class LayerOverviewUtils {
this.checkAllSvgs()
new DetectDuplicateFilters().convertStrict({
layers: ScriptUtils.getLayerFiles().map(f => f.parsed),
themes: ScriptUtils.getThemeFiles().map(f => f.parsed)
}, "GenerateLayerOverview:")
if (AllKnownLayouts.getSharedLayersConfigs().size == 0) {
console.error("This was a bootstrapping-run. Run generate layeroverview again!")
} else {