()
| 149 | font-size="20" |
| 150 | font-weight="600" |
| 151 | fill="${PALETTE.accent}" |
| 152 | >boringstack.xyz</text> |
| 153 | </svg> |
| 154 | `.trim(); |
| 155 | } |
| 156 | |
| 157 | async function main() { |
| 158 | const svg = buildSvg(); |
| 159 | |
| 160 | await mkdir(OUTPUT_DIR, { recursive: true }); |
| 161 | |
| 162 | let png; |
| 163 | try { |
| 164 | png = await sharp(Buffer.from(svg)).png({ compressionLevel: 9 }).toBuffer(); |
| 165 | } catch (err) { |
| 166 | // sharp/libvips failures (missing native binary in a lean CI image, OOM, |
| 167 | // malformed SVG) otherwise surface as an opaque stack with no origin. |
| 168 | const detail = err instanceof Error ? err.message : String(err); |
| 169 | throw new Error( |
| 170 | `sharp failed to rasterize the OG SVG (${svg.length} bytes) to PNG: ${detail}`, |
| 171 | { cause: err } |
| 172 | ); |
| 173 | } |
| 174 | |
| 175 | await writeFile(OUTPUT_PATH, png); |
| 176 | |
| 177 | console.log( |
no test coverage detected