DigitalConsumer.ISS/vue.release.config.js

71 lines
2.3 KiB
JavaScript

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__';
process.env.VUE_APP_GOOGLE_PLACES_API_KEY = "__VUE_APP_GOOGLE_PLACES_API_KEY__";
process.env.VUE_APP_SAFELITE_HOP = "__VUE_APP_SAFELITE_HOP__";
process.env.VUE_APP_ADYEN_ENVIRONMENT = '__VUE_APP_ADYEN_ENVIRONMENT__';
process.env.VUE_APP_ADYEN_CLIENT_KEY = '__VUE_APP_ADYEN_CLIENT_KEY__';
// GA & GTM
process.env.VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY = "__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__";
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().toUTCString(),
buildTimeFull: new Date().toISOString(),
buildTimeStamp: Math.floor(Date.now() / 1000)
}
const buildInfo = {
version: pkg.version,
...gitInfo,
...buildTimes,
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: {
loaderOptions: {
sass: {
// Load Order Matters!!!
// Note: only include functions, variables and mixins here
additionalData: `
@import "./node_modules/bootstrap/scss/functions";
@import "@/styles/ux-variables.scss";
@import "./node_modules/bootstrap/scss/variables";
@import "./node_modules/bootstrap/scss/mixins";
@import "@/styles/mixins/customMixins";
`,
},
},
},
configureWebpack: {
devtool: 'source-map',
plugins: [
new (require('webpack')).DefinePlugin({
__BUILD_INFO__: JSON.stringify(buildInfo)
})
]
},
};