From eabc10454ca0e5142f608e761e88c6faaaff187c Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Wed, 10 Jun 2026 14:57:52 -0400 Subject: [PATCH] Added initial code to display a build version string on the index.html page. --- public/index.html | 3 ++- vue.config.js | 38 +++++++++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/public/index.html b/public/index.html index 5e2434b9..bd345695 100644 --- a/public/index.html +++ b/public/index.html @@ -46,6 +46,7 @@
+ + - \ No newline at end of file diff --git a/vue.config.js b/vue.config.js index d9d97c60..07ff90bd 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,3 +1,30 @@ +const { execSync } = require('child_process'); +const pkg = require('./package.json'); + +function safeExec(cmd, fallback = 'unknown') { + try { + return execSync(cmd).toString().trim(); + } catch { + return fallback; + } +} + +const buildTime = new Date().toISOString(); +const buildTimeStamp = Math.floor(Date.now() / 1000); + +const gitInfo = { + commit: safeExec('git rev-parse --short HEAD', 'dev'), + branch: safeExec('git rev-parse --abbrev-ref HEAD', 'unknown') +}; + +const buildInfo = { + version: pkg.version, + buildTime: buildTime, + buildTimeStamp: buildTimeStamp, + ...gitInfo, + versionString: `${pkg.version}-${gitInfo.branch}-${gitInfo.commit}-${buildTimeStamp}` +}; + process.env.VUE_APP_CONSUMER_CF_DISTRO = 'https://digitalapi.dev.safelite.io'; process.env.VUE_APP_CURRENT_ENVIRONMENT = 'Localhost'; process.env.VUE_APP_CUSTOMER_PORTAL_URL = 'https://myaccountdev.safelite.com/'; @@ -32,7 +59,12 @@ module.exports = { } } }, - configureWebpack: { - devtool: 'source-map' + configureWebpack: { + devtool: 'source-map', + plugins: [ + new (require('webpack')).DefinePlugin({ + __BUILD_INFO__: JSON.stringify(buildInfo) + }) + ] } -}; +}; \ No newline at end of file