Adding updates for release vue config file.
This commit is contained in:
parent
0e0e1305f0
commit
4415a21e9c
1 changed files with 40 additions and 1 deletions
|
|
@ -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)
|
||||
})
|
||||
]
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue