forked from MapComplete/MapComplete
		
	Merge develop
This commit is contained in:
		
						commit
						0162d52b68
					
				
					 127 changed files with 6609 additions and 15167 deletions
				
			
		|  | @ -1,6 +1,5 @@ | |||
| import {lstatSync, readdirSync, readFileSync} from "fs"; | ||||
| import {Utils} from "../Utils"; | ||||
| 
 | ||||
| Utils.runningFromConsole = true | ||||
| import * as https from "https"; | ||||
| import {LayerConfigJson} from "../Customizations/JSON/LayerConfigJson"; | ||||
|  |  | |||
|  | @ -56,6 +56,10 @@ class LayerOverviewUtils { | |||
|             if (path != undefined && path.indexOf(expected) < 0) { | ||||
|                 errorCount.push("Layer is in an incorrect place. The path is " + path + ", but expected " + expected) | ||||
|             } | ||||
|             if(layerJson["hideUnderlayingFeaturesMinPercentage"] !== undefined){ | ||||
|                 errorCount.push("Layer "+layer.id+" contains an old 'hideUnderlayingFeaturesMinPercentage'") | ||||
|             }             | ||||
|              | ||||
| 
 | ||||
|             for (const image of images) { | ||||
|                 if (image.indexOf("{") >= 0) { | ||||
|  | @ -78,9 +82,8 @@ class LayerOverviewUtils { | |||
| 
 | ||||
|     main(args: string[]) { | ||||
| 
 | ||||
|         const lt = this.loadThemesAndLayers(); | ||||
|         const layerFiles = lt.layers; | ||||
|         const themeFiles = lt.themes; | ||||
|         const layerFiles = ScriptUtils.getLayerFiles(); | ||||
|         const themeFiles = ScriptUtils.getThemeFiles(); | ||||
| 
 | ||||
| 
 | ||||
|         console.log("   ---------- VALIDATING ---------") | ||||
|  | @ -102,7 +105,9 @@ class LayerOverviewUtils { | |||
|         } | ||||
| 
 | ||||
|         let themeErrorCount = [] | ||||
|         for (const themeFile of themeFiles) { | ||||
|         for (const themeInfo of themeFiles) { | ||||
|             const themeFile = themeInfo.parsed | ||||
|             const themePath = themeInfo.path | ||||
|             if (typeof themeFile.language === "string") { | ||||
|                 themeErrorCount.push("The theme " + themeFile.id + " has a string as language. Please use a list of strings") | ||||
|             } | ||||
|  | @ -111,8 +116,8 @@ class LayerOverviewUtils { | |||
|                     if (!knownLayerIds.has(layer)) { | ||||
|                         themeErrorCount.push(`Unknown layer id: ${layer} in theme ${themeFile.id}`) | ||||
|                     } | ||||
|                 } else if (layer.builtin !== undefined) { | ||||
|                     let names = layer.builtin; | ||||
|                 } else if (layer["builtin"] !== undefined) { | ||||
|                     let names = layer["builtin"]; | ||||
|                     if (typeof names === "string") { | ||||
|                         names = [names] | ||||
|                     } | ||||
|  | @ -123,16 +128,16 @@ class LayerOverviewUtils { | |||
|                         return | ||||
|                     }) | ||||
|                 } else { | ||||
|                     layerErrorCount.push(...this.validateLayer(layer, undefined, knownPaths, themeFile.id)) | ||||
|                     if (knownLayerIds.has(layer.id)) { | ||||
|                         throw `The theme ${themeFile.id} defines a layer with id ${layer.id}, which is the same as an already existing layer` | ||||
|                     layerErrorCount.push(...this.validateLayer(<LayerConfigJson>layer, undefined, knownPaths, themeFile.id)) | ||||
|                     if (knownLayerIds.has(layer["id"])) { | ||||
|                         throw `The theme ${themeFile.id} defines a layer with id ${layer["id"]}, which is the same as an already existing layer` | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             themeFile.layers = themeFile.layers | ||||
|                 .filter(l => typeof l != "string") // We remove all the builtin layer references as they don't work with ts-node for some weird reason
 | ||||
|                 .filter(l => l.builtin === undefined) | ||||
|                 .filter(l => l["builtin"] === undefined) | ||||
| 
 | ||||
| 
 | ||||
|             try { | ||||
|  | @ -140,6 +145,12 @@ class LayerOverviewUtils { | |||
|                 if (theme.id !== theme.id.toLowerCase()) { | ||||
|                     themeErrorCount.push("Theme ids should be in lowercase, but it is " + theme.id) | ||||
|                 } | ||||
|                 let filename = themePath.substring(themePath.lastIndexOf("/") + 1, themePath.length - 5) | ||||
|                 if(theme.id !== filename){ | ||||
|                     themeErrorCount.push("Theme ids should be the same as the name.json, but we got id: " + theme.id + " and filename "+filename+" ("+themePath+")") | ||||
|                 } | ||||
|              | ||||
|              | ||||
|             } catch (e) { | ||||
|                 themeErrorCount.push("Could not parse theme " + themeFile["id"] + "due to", e) | ||||
|             } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue