Skip to content

Commit 890c90f

Browse files
authored
Merge pull request #247 from loathers/upgrade-puppeteer-and-convert-to-svg
Upgrade puppeteer and svg-to-png
2 parents 5986615 + 94a1313 commit 890c90f

File tree

4 files changed

+609
-379
lines changed

4 files changed

+609
-379
lines changed

packages/oaf/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
"@remix-run/react": "^2.16.2",
2929
"@remix-run/serve": "^2.16.2",
3030
"@remix-run/server-runtime": "^2.16.2",
31-
"@types/node": "^22.13.13",
31+
"@types/node": "^24.0.13",
3232
"@types/serialize-error": "^4.0.1",
3333
"body-parser": "^1.20.3",
34-
"convert-svg-to-png": "^0.6.4",
34+
"convert-svg-to-png": "^0.7.1",
3535
"cors": "^2.8.5",
3636
"date-fns": "^4.1.0",
3737
"discord.js": "^14.18.0",
@@ -47,7 +47,7 @@
4747
"otplib": "^12.0.1",
4848
"pretty-ms": "^9.2.0",
4949
"proj4": "^2.15.0",
50-
"puppeteer": "13.7.0",
50+
"puppeteer": "24.12.1",
5151
"react": "^19.0.0",
5252
"react-dom": "^19.0.0",
5353
"remix-auth": "^4.1.0",

packages/oaf/src/svgConverter.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
import svgToPng from "convert-svg-to-png";
2-
import type { Converter } from "convert-svg-to-png";
1+
import { createConverter } from "convert-svg-to-png";
2+
import { executablePath } from "puppeteer";
33

44
let timeout: ReturnType<typeof setTimeout> | null = null;
5-
let converter: Converter | null = null;
5+
let converter: Awaited<ReturnType<typeof createConverter>> | null = null;
66

77
export async function renderSvg(svg: string) {
8-
if (converter === null || converter.destroyed) {
9-
converter = svgToPng.createConverter({
10-
puppeteer: { args: ["--no-sandbox"] },
8+
if (converter === null || converter.closed) {
9+
converter = await createConverter({
10+
launch: {
11+
executablePath,
12+
args: ["--no-sandbox"],
13+
},
1114
});
1215

1316
if (timeout !== null) clearTimeout(timeout);
1417
timeout = setTimeout(() => {
15-
converter?.destroy();
18+
converter?.close();
1619
timeout = null;
1720
}, 60000);
1821
}

packages/oaf/src/types.d.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)