From 4415a21e9c720f63d6b677b71fae87eee4ed12b2 Mon Sep 17 00:00:00 2001 From: Jeremy-Z Date: Thu, 11 Jun 2026 12:11:10 -0400 Subject: [PATCH] Adding updates for release vue config file. --- vue.release.config.js | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/vue.release.config.js b/vue.release.config.js index 43abce0e..18cc1771 100644 --- a/vue.release.config.js +++ b/vue.release.config.js @@ -1,3 +1,6 @@ +const { execSync } = require('child_process'); +const pkg = require('./package.json'); + process.env.VUE_APP_CONSUMER_CF_DISTRO = "__VUE_APP_CONSUMER_CF_DISTRO__"; process.env.VUE_APP_CURRENT_ENVIRONMENT = "__VUE_APP_CURRENT_ENVIRONMENT__"; process.env.VUE_APP_CUSTOMER_PORTAL_URL = '__VUE_APP_CUSTOMER_PORTAL_URL__'; @@ -11,6 +14,37 @@ process.env.VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY = "__VUE_APP_GOOGLE_TAG_MANAG process.env.VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC = "__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__" process.env.VUE_APP_GOOGLE_MAPS_API_SCRIPT = "__VUE_APP_GOOGLE_MAPS_API_SCRIPT__"; +function safeExec(cmd, fallback = 'unknown') { + try { + return execSync(cmd).toString().trim(); + } catch { + return fallback; + } +} + +const gitInfo = { + commit: safeExec('git rev-parse --short HEAD', 'dev'), + branch: safeExec('git rev-parse --abbrev-ref HEAD', 'unknown') +}; + +const buildTimes = { + buildTime: new Date().toISOString(), + buildTimeLocal: new Date().toLocaleString(), + buildTimeStamp: Math.floor(Date.now() / 1000) +} + +const buildInfo = { + version: pkg.version, + buildTime: buildTimes.buildTime, + buildTimeLocal: buildTimes.buildTimeLocal, + buildTimeStamp: buildTimes.buildTimeStamp, + ...gitInfo, + versionString: `${pkg.version}-${gitInfo.commit}-${buildTimes.buildTimeStamp}-${gitInfo.branch}` +}; + +// This will be replaced by the actual build info during the build process via webpack.DefinePlugin in this config file. +__BUILD_INFO__ = buildInfo; + module.exports = { publicPath: "/", css: { @@ -29,6 +63,11 @@ module.exports = { }, }, configureWebpack: { - devtool: 'source-map' + devtool: 'source-map', + plugins: [ + new (require('webpack')).DefinePlugin({ + __BUILD_INFO__: JSON.stringify(buildInfo) + }) + ] }, };