forked from MapComplete/MapComplete
		
	Re-enable images warning, add argument to script
This commit is contained in:
		
							parent
							
								
									902b766410
								
							
						
					
					
						commit
						16da5d6d36
					
				
					 2 changed files with 5 additions and 3 deletions
				
			
		| 
						 | 
					@ -291,7 +291,7 @@ export class ValidateTagRenderings extends Fuse<TagRenderingConfigJson> {
 | 
				
			||||||
        super("Various validation on tagRenderingConfigs",
 | 
					        super("Various validation on tagRenderingConfigs",
 | 
				
			||||||
        // TODO enable these checks again
 | 
					        // TODO enable these checks again
 | 
				
			||||||
        //    new DetectShadowedMappings(),
 | 
					        //    new DetectShadowedMappings(),
 | 
				
			||||||
         //   new DetectMappingsWithImages()    e
 | 
					            new DetectMappingsWithImages()    
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,6 +3,7 @@ import {DesugaringStep} from "../Models/ThemeConfig/Conversion/Conversion";
 | 
				
			||||||
import {LayerConfigJson} from "../Models/ThemeConfig/Json/LayerConfigJson";
 | 
					import {LayerConfigJson} from "../Models/ThemeConfig/Json/LayerConfigJson";
 | 
				
			||||||
import {Utils} from "../Utils";
 | 
					import {Utils} from "../Utils";
 | 
				
			||||||
import Translations from "../UI/i18n/Translations";
 | 
					import Translations from "../UI/i18n/Translations";
 | 
				
			||||||
 | 
					import TagRenderingConfig from "../Models/ThemeConfig/TagRenderingConfig";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ConvertImagesToIcon extends DesugaringStep<LayerConfigJson> {
 | 
					class ConvertImagesToIcon extends DesugaringStep<LayerConfigJson> {
 | 
				
			||||||
    private _iconClass: string;
 | 
					    private _iconClass: string;
 | 
				
			||||||
| 
						 | 
					@ -55,11 +56,12 @@ function main() {
 | 
				
			||||||
    args.splice(0, 2)
 | 
					    args.splice(0, 2)
 | 
				
			||||||
    const path = args[0]
 | 
					    const path = args[0]
 | 
				
			||||||
    const iconClass = args[1] ?? "small"
 | 
					    const iconClass = args[1] ?? "small"
 | 
				
			||||||
 | 
					    const targetFile = args[2] ?? path + ".autoconverted.json"
 | 
				
			||||||
    console.log("Fixing images in " + path)
 | 
					    console.log("Fixing images in " + path)
 | 
				
			||||||
    const parsed = JSON.parse(readFileSync(path, "UTF8"))
 | 
					    const parsed = JSON.parse(readFileSync(path, "UTF8"))
 | 
				
			||||||
    const converted = new ConvertImagesToIcon(iconClass).convertStrict(parsed, "While running the fixImagesInTagRenderings-script")
 | 
					    const converted = new ConvertImagesToIcon(iconClass).convertStrict(parsed, "While running the fixImagesInTagRenderings-script")
 | 
				
			||||||
    writeFileSync(path + ".autoconverted.json", JSON.stringify(converted, null, "    "))
 | 
					    writeFileSync(targetFile, JSON.stringify(converted, null, "    "))
 | 
				
			||||||
    console.log("Written fixed version to " + path + ".autoconverted.json")
 | 
					    console.log("Written fixed version to " + targetFile)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
main();
 | 
					main();
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue