Added initial code to display a build version string on the index.html page.
This commit is contained in:
parent
53ded9b2d3
commit
eabc10454c
2 changed files with 37 additions and 4 deletions
|
|
@ -46,6 +46,7 @@
|
||||||
</noscript>
|
</noscript>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<!-- built files will be auto injected -->
|
<!-- built files will be auto injected -->
|
||||||
|
<!-- Version: <%= __BUILD_INFO__.versionString %> -->
|
||||||
|
<!-- <%= JSON.stringify(__BUILD_INFO__) %> -->
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -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_CONSUMER_CF_DISTRO = 'https://digitalapi.dev.safelite.io';
|
||||||
process.env.VUE_APP_CURRENT_ENVIRONMENT = 'Localhost';
|
process.env.VUE_APP_CURRENT_ENVIRONMENT = 'Localhost';
|
||||||
process.env.VUE_APP_CUSTOMER_PORTAL_URL = 'https://myaccountdev.safelite.com/';
|
process.env.VUE_APP_CUSTOMER_PORTAL_URL = 'https://myaccountdev.safelite.com/';
|
||||||
|
|
@ -32,7 +59,12 @@ module.exports = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
devtool: 'source-map'
|
devtool: 'source-map',
|
||||||
|
plugins: [
|
||||||
|
new (require('webpack')).DefinePlugin({
|
||||||
|
__BUILD_INFO__: JSON.stringify(buildInfo)
|
||||||
|
})
|
||||||
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Loading…
Reference in a new issue