install missing libraries and font

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-08-03 23:41:39 +08:00
parent 5b9c6bec35
commit 8922f7f2f4
+6 -1
View File
@@ -21,6 +21,11 @@ const execFileAsync = promisify(execFile);
const TEMPLATE_PATH = path.join(__dirname, '../templates/certificate.typ'); const TEMPLATE_PATH = path.join(__dirname, '../templates/certificate.typ');
const FONT_PATH = path.join(__dirname, '../templates/fonts/Arimo'); const FONT_PATH = path.join(__dirname, '../templates/fonts/Arimo');
// The Docker image gets `typst` on PATH via COPY --from=typst. Bare-metal
// deploys (no Docker involved) don't have that, so TYPST_BIN lets ops point
// at a manually-installed binary instead.
const TYPST_BIN = process.env.TYPST_BIN || 'typst';
/** /**
* @param {{ * @param {{
* name: string, * name: string,
@@ -52,7 +57,7 @@ async function generateCertificate({ name, course, date, cert_no, ref_no, instru
if (length) args.push('--input', `length=${length}`); if (length) args.push('--input', `length=${length}`);
try { try {
await execFileAsync('typst', args); await execFileAsync(TYPST_BIN, args);
return await fs.readFile(outPath); return await fs.readFile(outPath);
} finally { } finally {
await fs.unlink(outPath).catch(() => {}); await fs.unlink(outPath).catch(() => {});