Way to retrieve Git commit date in Pages/Functions

I have a Vuejs v3 website deployed as a Cloudflare Pages.
I need to get the git commit date.
In the client side, I declare a variable in my vue.config.js

but I’m looking for a solution for the server side. It is deployed under /function/api.js .
I probably generate a file during the build process, but if someone have a better and cleaner idea :thinking:.

const gitlog = require("gitlog").default;
const fs = require('fs');

const commits = gitlog({
  repo: ".",
  number: 1,
  fields: ["authorDate"],
});

const commits_submodule = gitlog(
  {
    repo: "submodule",
    number: 1,
    fields: ["authorDate"],
  }
fs.writeFile('./commit.json', JSON.stringify(
  { base: (new Date(commits[0].authorDate)).toISOString(), 
    submodule: (new Date(commits_submodule[0].authorDate)).toISOString(), 
  }), 
  'utf8', function (err) {
                            if (err) return console.log(err);
                          }
           );

and in my /functions/api.js

const commit = require('../commit.json');
export async function onRequestGet(context) {
    console.log(commit); //I get my two commit dates as properties
    let stringXML = await getResponse()
    return new Response(stringXML, {
        headers: {
          "content-type": "text/xml"
        }
      });


Thanks
Ronan