diff --git a/scripts/build.sh b/scripts/build.sh index d8a9b60cc..3d3186b73 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -9,12 +9,22 @@ echo "Starting build" # sanity check if [[ -f "bookcases.html" ]] then - echo "Bookcases exists" + echo "Bookcases theme exists" else echo "Bookcases.html does not exist - aborting" exit 1 fi +# sanity check +if [[ -f "waste.html" ]] +then + echo "Waste theme exists" +else + echo "waste.html does not exist - aborting" + exit 1 +fi + + export NODE_OPTIONS=--max-old-space-size=16000 which vite vite --version diff --git a/scripts/generateLayerOverview.ts b/scripts/generateLayerOverview.ts index b0df401c4..e0d1bd380 100644 --- a/scripts/generateLayerOverview.ts +++ b/scripts/generateLayerOverview.ts @@ -806,6 +806,9 @@ class LayerOverviewUtils extends Script { try { ScriptUtils.ReadSvgSync(themeFile.icon, (svg) => { const width: string = svg["$"].width + if (width === undefined) { + throw "The logo at " + themeFile.icon + " does not have a defined width" + } const height: string = svg["$"].height const err = themeFile.hideFromOverview ? console.warn : console.error if (width !== height) { @@ -815,6 +818,11 @@ class LayerOverviewUtils extends Script { err(e) } + + if (width?.endsWith("%")) { + throw "The logo at " + themeFile.icon + " has a relative width; this is not supported" + } + const w = parseInt(width) const h = parseInt(height) if (w < 370 || h < 370) { diff --git a/scripts/generateLayouts.ts b/scripts/generateLayouts.ts index abb1d6a64..9f1f5a54e 100644 --- a/scripts/generateLayouts.ts +++ b/scripts/generateLayouts.ts @@ -89,8 +89,8 @@ class GenerateLayouts extends Script { try { // We already read to file, in order to crash here if the file is not found - let img = await sharp(iconPath) - let resized = await img.resize(size) + const img = await sharp(iconPath) + const resized = await img.resize(size) await resized.toFile(targetpath) console.log("Created png version at ", newname) } catch (e) { @@ -457,16 +457,29 @@ class GenerateLayouts extends Script { let ogImage = layout.socialImage let twitterImage = ogImage if (ogImage === LayoutConfig.defaultSocialImage && layout.official) { - ogImage = (await this.createSocialImage(layout, "")) ?? layout.socialImage - twitterImage = (await this.createSocialImage(layout, "Wide")) ?? layout.socialImage + try{ + ogImage = (await this.createSocialImage(layout, "")) ?? layout.socialImage + twitterImage = (await this.createSocialImage(layout, "Wide")) ?? layout.socialImage + }catch (e) { + console.error("Could not generate image:", e) + } } if (twitterImage.endsWith(".svg")) { + try{ + // svgs are badly supported as social image, we use a generated svg instead twitterImage = await this.createIcon(twitterImage, 512, alreadyWritten) + }catch (e) { + console.error("Could not generate image:", e) + } } if (ogImage.endsWith(".svg")) { - ogImage = await this.createIcon(ogImage, 512, alreadyWritten) + try{ + ogImage = await this.createIcon(ogImage, 512, alreadyWritten) + }catch (e) { + console.error("Could not generate image:", e) + } } let customCss = "" @@ -506,7 +519,7 @@ class GenerateLayouts extends Script { apple_icons.push(``) } - let themeSpecific = [ + const themeSpecific = [ `