Undo some changes to fix the build, move svg-check into generateLayerOverview as to move fs out of the dependency tree for the webpage

This commit is contained in:
Pieter Vander Vennet 2023-01-17 01:00:43 +01:00
parent 39cc043f8b
commit e9004a2190
7 changed files with 543 additions and 130 deletions

View file

@ -195,34 +195,6 @@ class ValidateTheme extends DesugaringStep<LayoutConfigJson> {
information
)
}
if (json.icon.endsWith(".svg")) {
try {
ScriptUtils.ReadSvgSync(json.icon, (svg) => {
const width: string = svg.$.width
const height: string = svg.$.height
if (width !== height) {
const e =
`the icon for theme ${json.id} is not square. Please square the icon at ${json.icon}` +
` Width = ${width} height = ${height}`
;(json.hideFromOverview ? warnings : errors).push(e)
}
const w = parseInt(width)
const h = parseInt(height)
if (w < 370 || h < 370) {
const e: string = [
`the icon for theme ${json.id} is too small. Please rescale the icon at ${json.icon}`,
`Even though an SVG is 'infinitely scaleable', the icon should be dimensioned bigger. One of the build steps of the theme does convert the image to a PNG (to serve as PWA-icon) and having a small dimension will cause blurry images.`,
` Width = ${width} height = ${height}; we recommend a size of at least 500px * 500px and to use a square aspect ratio.`,
].join("\n")
;(json.hideFromOverview ? warnings : errors).push(e)
}
})
} catch (e) {
console.error("Could not read " + json.icon + " due to " + e)
}
}
}
try {