const dayjs = require('dayjs'); const fs = require('fs'); const generateAppBuild = () => { const getVersion = () => fs.readFileSync('version.txt', 'utf8'); const commit = process.env.VERCEL_GIT_COMMIT_SHA ? process.env.VERCEL_GIT_COMMIT_SHA : getVersion(); const appBuildContent = { display: `${dayjs().format('YYYY-MM-DD')}`, version: `${commit} - ${dayjs().format()}`, commit, date: dayjs().format(), }; fs.writeFileSync( './app-build.json', JSON.stringify(appBuildContent, null, 2) ); }; generateAppBuild();