forked from MapComplete/MapComplete
		
	Performance: split validation into multiple files, avoid using 'fixImages' and 'exractImages' into well-known themes as it takes a big chunk of data
This commit is contained in:
		
							parent
							
								
									7d20a1924f
								
							
						
					
					
						commit
						b91b1378d1
					
				
					 16 changed files with 1009 additions and 949 deletions
				
			
		| 
						 | 
				
			
			@ -9,7 +9,6 @@ import {
 | 
			
		|||
    DoesImageExist,
 | 
			
		||||
    PrevalidateTheme,
 | 
			
		||||
    ValidateLayer,
 | 
			
		||||
    ValidateThemeAndLayers,
 | 
			
		||||
    ValidateThemeEnsemble,
 | 
			
		||||
} from "../src/Models/ThemeConfig/Conversion/Validation"
 | 
			
		||||
import { Translation } from "../src/UI/i18n/Translation"
 | 
			
		||||
| 
						 | 
				
			
			@ -33,6 +32,8 @@ import { GenerateFavouritesLayer } from "./generateFavouritesLayer"
 | 
			
		|||
import LayoutConfig from "../src/Models/ThemeConfig/LayoutConfig"
 | 
			
		||||
import Translations from "../src/UI/i18n/Translations"
 | 
			
		||||
import { Translatable } from "../src/Models/ThemeConfig/Json/Translatable"
 | 
			
		||||
import { ValidateThemeAndLayers } from "../src/Models/ThemeConfig/Conversion/ValidateThemeAndLayers"
 | 
			
		||||
import { ExtractImages } from "../src/Models/ThemeConfig/Conversion/FixImages"
 | 
			
		||||
 | 
			
		||||
// This scripts scans 'src/assets/layers/*.json' for layer definition files and 'src/assets/themes/*.json' for theme definition files.
 | 
			
		||||
// It spits out an overview of those to be used to load them
 | 
			
		||||
| 
						 | 
				
			
			@ -272,6 +273,7 @@ class LayerOverviewUtils extends Script {
 | 
			
		|||
            JSON.stringify(theme, null, "  "),
 | 
			
		||||
            { encoding: "utf8" }
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    writeLayer(layer: LayerConfigJson) {
 | 
			
		||||
| 
						 | 
				
			
			@ -850,6 +852,11 @@ class LayerOverviewUtils extends Script {
 | 
			
		|||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                const usedImages = Utils.Dedup(new ExtractImages(true, knownTagRenderings).convertStrict(themeFile).map(x => x.path))
 | 
			
		||||
                usedImages.sort()
 | 
			
		||||
 | 
			
		||||
                themeFile["_usedImages"] = usedImages
 | 
			
		||||
 | 
			
		||||
                this.writeTheme(themeFile)
 | 
			
		||||
                fixed.set(themeFile.id, themeFile)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue