mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
install missing libraries and font
Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
@@ -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(() => {});
|
||||||
|
|||||||
Reference in New Issue
Block a user