Deno Builds on Netlify
The Netlify build environment is a Docker image with preinstalled packages like Node and Python. For sensible reasons the packages are rather “stable”, or “outdated”, depending on your sensibilities. Environment variables like
NODE_VERSION=16.5 are used to update dependencies if you live on the edge.
If you live too far on the edge, Netlify doesn’t provide enough. Deno is notably missing for my purposes. My website is hosted on Netlify and built with my very own bespoke Deno-powered scuffed static site generator.
To run Deno on Netlify first configure the build command with a shell script:
[build] command = "./src/build.sh"
Then install and run Deno within the script:
#!/bin/bash curl -fsSL https://deno.land/x/install/install.sh | sh export PATH="/opt/buildhome/.deno/bin:$PATH" deno --version exit 0
deno --version with
deno run [...] to run the actual build.
I’m not sure if updating
PATH is necessary but it can’t hurt and I’m too lazy to test.
deno_modules directory makes me uneasy.
I have a feeling Deno might be officially added to Netlify eventually. Of course, this is all just experimental. Most established build tools are written for Node. I’m really interested in SvelteKit and Astro right now.