Scripts: add timing information

This commit is contained in:
Pieter Vander Vennet 2023-10-31 11:50:03 +01:00
parent fa83a51df5
commit 449c1adb00

View file

@ -353,6 +353,8 @@ class LayerOverviewUtils extends Script {
} }
async main(args: string[]) { async main(args: string[]) {
console.log("Generating layer overview...")
const start = new Date()
const forceReload = args.some((a) => a == "--force") const forceReload = args.some((a) => a == "--force")
const licensePaths = new Set<string>() const licensePaths = new Set<string>()
@ -429,11 +431,17 @@ class LayerOverviewUtils extends Script {
ConversionContext.construct([], []) ConversionContext.construct([], [])
) )
const end = new Date()
const millisNeeded = end.getTime() - start.getTime()
if (AllSharedLayers.getSharedLayersConfigs().size == 0) { if (AllSharedLayers.getSharedLayersConfigs().size == 0) {
console.error("This was a bootstrapping-run. Run generate layeroverview again!") console.error(
"This was a bootstrapping-run. Run generate layeroverview again!(" +
millisNeeded +
" ms)"
)
} else { } else {
const green = (s) => "\x1b[92m" + s + "\x1b[0m" const green = (s) => "\x1b[92m" + s + "\x1b[0m"
console.log(green("All done!")) console.log(green("All done! (" + millisNeeded + " ms)"))
} }
} }
@ -701,13 +709,11 @@ class LayerOverviewUtils extends Script {
themeFile, themeFile,
ConversionContext.construct([themePath], ["PrepareLayer"]) ConversionContext.construct([themePath], ["PrepareLayer"])
) )
new ValidateThemeAndLayers( new ValidateThemeAndLayers(
new DoesImageExist(licensePaths, existsSync, knownTagRenderings), new DoesImageExist(licensePaths, existsSync, knownTagRenderings),
themePath, themePath,
true, true,
knownTagRenderings, knownTagRenderings
`Validating ${i}/${themeFiles.length} '${themeInfo.parsed.id}'`
).convertStrict( ).convertStrict(
themeFile, themeFile,
ConversionContext.construct([themePath], ["PrepareLayer"]) ConversionContext.construct([themePath], ["PrepareLayer"])