diff --git a/scripts/generateLayerOverview.ts b/scripts/generateLayerOverview.ts index 5d1a088df..85890487e 100644 --- a/scripts/generateLayerOverview.ts +++ b/scripts/generateLayerOverview.ts @@ -442,29 +442,30 @@ class LayerOverviewUtils { if (themeFile.icon.endsWith(".svg")) { try { - ScriptUtils.ReadSvgSync(json.icon, (svg) => { + ScriptUtils.ReadSvgSync(themeFile.icon, (svg) => { const width: string = svg.$.width const height: string = svg.$.height + const err = themeFile.hideFromOverview ? console.warn : console.error if (width !== height) { const e = - `the icon for theme ${json.id} is not square. Please square the icon at ${json.icon}` + + `the icon for theme ${themeFile.id} is not square. Please square the icon at ${themeFile.icon}` + ` Width = ${width} height = ${height}` - ;(json.hideFromOverview ? warnings : errors).push(e) + err(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}`, + `the icon for theme ${themeFile.id} is too small. Please rescale the icon at ${themeFile.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) + err(e) } }) } catch (e) { - console.error("Could not read " + json.icon + " due to " + e) + console.error("Could not read " + themeFile.icon + " due to " + e) } } diff --git a/scripts/slice.ts b/scripts/slice.ts index 041619c8d..214f5dad0 100644 --- a/scripts/slice.ts +++ b/scripts/slice.ts @@ -76,7 +76,7 @@ async function readGeojsonLineByLine(inputFile: string): Promise { async function readFeaturesFromGeoJson(inputFile: string): Promise { try { - return JSON.parse(fs.readFileSync(inputFile, "UTF-8")).features + return JSON.parse(fs.readFileSync(inputFile, { encoding: "utf-8" })).features } catch (e) { // We retry, but with a line-by-line approach return await readGeojsonLineByLine(inputFile)