I’m wondering if the following is possible using Netlify:
Each time a deploy is triggered, Netlify builds my site. My site has a
package.json file, and within it, a
build task, which builds the contents to the
/build directory, which Netlify serves from.
Is it possible during that
build task, to run a script (in my codebase) which makes a network request and saves the contents to disk, maybe somewhere in the
/build dir? The reason I want to do this is on my site: https://algoapp.xyz, I make a page load HTTP request to a Netlify Function which returns some JSON to my front-end. This data only changes once a day, but I’m hitting my Function every single time someone visits the site. My idea was to trigger a deploy once a day, have a script fetch the needed data, store it in, for example,
data.json, and have my front-end just
require() it in locally, vs making the HTTP request to my function.
tl;dr - can i run an async build task and have it write some data to disk which could be
required()'d from my JS code?