feat: new website
This commit is contained in:
commit
50c1c47e2b
64 changed files with 2908 additions and 0 deletions
42
scripts/build-cv.ts
Normal file
42
scripts/build-cv.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env bun
|
||||
import { mkdir } from "node:fs/promises"
|
||||
import { dirname } from "node:path"
|
||||
import { chromium } from "playwright"
|
||||
|
||||
const url = "file:///finch/da.nfin.ch/dist/cv.html"
|
||||
const output = "dist/cv.pdf"
|
||||
|
||||
await mkdir(dirname(output), { recursive: true })
|
||||
|
||||
const executablePath =
|
||||
process.env.CHROMIUM_PATH ??
|
||||
Bun.which("thorium-browser") ??
|
||||
Bun.which("chromium") ??
|
||||
Bun.which("chromium-browser") ??
|
||||
Bun.which("google-chrome") ??
|
||||
Bun.which("google-chrome-canary") ??
|
||||
undefined
|
||||
|
||||
const browser = await chromium.launch({
|
||||
executablePath,
|
||||
headless: true,
|
||||
args: ["--no-sandbox", "--disable-gpu"],
|
||||
})
|
||||
|
||||
try {
|
||||
const page = await browser.newPage()
|
||||
|
||||
await page.goto(url, {
|
||||
waitUntil: "networkidle",
|
||||
timeout: 30_000,
|
||||
})
|
||||
|
||||
await page.pdf({
|
||||
path: output,
|
||||
printBackground: true,
|
||||
displayHeaderFooter: false,
|
||||
preferCSSPageSize: true,
|
||||
})
|
||||
} finally {
|
||||
await browser.close()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue