Re-enable images warning, add argument to script

This commit is contained in:
pietervdvn 2022-02-18 03:19:05 +01:00
parent 902b766410
commit 16da5d6d36
2 changed files with 5 additions and 3 deletions

View file

@ -291,7 +291,7 @@ export class ValidateTagRenderings extends Fuse<TagRenderingConfigJson> {
super("Various validation on tagRenderingConfigs",
// TODO enable these checks again
// new DetectShadowedMappings(),
// new DetectMappingsWithImages() e
new DetectMappingsWithImages()
);
}
}

View file

@ -3,6 +3,7 @@ import {DesugaringStep} from "../Models/ThemeConfig/Conversion/Conversion";
import {LayerConfigJson} from "../Models/ThemeConfig/Json/LayerConfigJson";
import {Utils} from "../Utils";
import Translations from "../UI/i18n/Translations";
import TagRenderingConfig from "../Models/ThemeConfig/TagRenderingConfig";
class ConvertImagesToIcon extends DesugaringStep<LayerConfigJson> {
private _iconClass: string;
@ -55,11 +56,12 @@ function main() {
args.splice(0, 2)
const path = args[0]
const iconClass = args[1] ?? "small"
const targetFile = args[2] ?? path + ".autoconverted.json"
console.log("Fixing images in " + path)
const parsed = JSON.parse(readFileSync(path, "UTF8"))
const converted = new ConvertImagesToIcon(iconClass).convertStrict(parsed, "While running the fixImagesInTagRenderings-script")
writeFileSync(path + ".autoconverted.json", JSON.stringify(converted, null, " "))
console.log("Written fixed version to " + path + ".autoconverted.json")
writeFileSync(targetFile, JSON.stringify(converted, null, " "))
console.log("Written fixed version to " + targetFile)
}
main();