Make main.ts print the commit short hash.
This commit is contained in:
parent
c635c2c5c7
commit
67f9703a33
|
@ -17,7 +17,8 @@
|
||||||
"globals": {
|
"globals": {
|
||||||
"pageContent": "writable",
|
"pageContent": "writable",
|
||||||
"module": "writable",
|
"module": "writable",
|
||||||
"process": "writable"
|
"process": "writable",
|
||||||
|
"__COMMIT_HASH__": "writable"
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-unused-vars": [
|
"no-unused-vars": [
|
||||||
|
|
|
@ -126,6 +126,8 @@ async function onLoad() {
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', async function () {
|
document.addEventListener('DOMContentLoaded', async function () {
|
||||||
|
// @ts-expect-error
|
||||||
|
console.log("Loading Version:", __COMMIT_HASH__);
|
||||||
i18next.init({
|
i18next.init({
|
||||||
lng: pageState.language,
|
lng: pageState.language,
|
||||||
fallbackLng: 'en',
|
fallbackLng: 'en',
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
|
||||||
|
@ -6,6 +8,9 @@ const VERBOSE = Object.getOwnPropertyNames(process.env).includes("VERBOSE") || !
|
||||||
const MODE = process.env.WEBPACK_MODE || "production"
|
const MODE = process.env.WEBPACK_MODE || "production"
|
||||||
const DEBUG = MODE != "production";
|
const DEBUG = MODE != "production";
|
||||||
|
|
||||||
|
let commitHash = require('child_process')
|
||||||
|
.execSync('git rev-parse --short HEAD')
|
||||||
|
.toString();
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
mode: MODE,
|
mode: MODE,
|
||||||
|
@ -20,7 +25,13 @@ module.exports = {
|
||||||
colors: true,
|
colors: true,
|
||||||
timings: true,
|
timings: true,
|
||||||
},
|
},
|
||||||
plugins: [new MiniCssExtractPlugin(), new HtmlWebpackPlugin({ title: "VaultUI" })],
|
plugins: [
|
||||||
|
new MiniCssExtractPlugin(),
|
||||||
|
new HtmlWebpackPlugin({ title: "VaultUI" }),
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
__COMMIT_HASH__: JSON.stringify(commitHash),
|
||||||
|
})
|
||||||
|
],
|
||||||
devServer: {
|
devServer: {
|
||||||
open: process.env.BROWSER || "microsoft-edge-dev",
|
open: process.env.BROWSER || "microsoft-edge-dev",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue