Journals for

2022-09-24

🔗

Finished this iteration of the blog update. With the new SvelteKit version I had to update my janky method of getting the social card generator WASM and fonts into the Vercel deploy. Wasn't too bad overall though. The main trick is to read files from the working directory when in Vercel, and otherwise read from whereever the files are on your local computer.

const dirname = process.env.VERCEL
  ? process.cwd()
  : path.dirname(fileURLToPath(import.meta.url));

fs.readFileSync(path.join(dirname, 'font.ttf'));

Then finally, update your build command to not only run vite build, but also copy the files into the Vercel output:

vite build && \
  cp ./src/lib/og-image/*.ttf \
     ./.vercel/output/functions/render.func/

Not pretty and rather fragile, but it works for now.

Now that I have this "journal" functionality, next up will be some automatic tagging and an index sidebar for the journals. But at least it's finished enough now that I have a low-friction writing process for short stuff, since I haven't done any real writing in almost a year.


Thanks for reading! If you have any questions or comments, please send me a note on Twitter.