Improve BUILD_STRING.
This commit is contained in:
parent
67f9703a33
commit
74092cf62d
|
@ -18,7 +18,7 @@
|
||||||
"pageContent": "writable",
|
"pageContent": "writable",
|
||||||
"module": "writable",
|
"module": "writable",
|
||||||
"process": "writable",
|
"process": "writable",
|
||||||
"__COMMIT_HASH__": "writable"
|
"BUILD_STRING": "writable"
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-unused-vars": [
|
"no-unused-vars": [
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
"eslint-plugin-import": "^2.22.1",
|
"eslint-plugin-import": "^2.22.1",
|
||||||
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
|
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
|
"git-revision-webpack-plugin": "^5.0.0",
|
||||||
"html-webpack-plugin": "^5.3.1",
|
"html-webpack-plugin": "^5.3.1",
|
||||||
"i18next": "^20.2.1",
|
"i18next": "^20.2.1",
|
||||||
"mini-css-extract-plugin": "^1.4.1",
|
"mini-css-extract-plugin": "^1.4.1",
|
||||||
|
|
|
@ -126,8 +126,9 @@ async function onLoad() {
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', async function () {
|
document.addEventListener('DOMContentLoaded', async function () {
|
||||||
|
console.log("Loading...");
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
console.log("Loading Version:", __COMMIT_HASH__);
|
console.log("Build Data:", BUILD_STRING);
|
||||||
i18next.init({
|
i18next.init({
|
||||||
lng: pageState.language,
|
lng: pageState.language,
|
||||||
fallbackLng: 'en',
|
fallbackLng: 'en',
|
||||||
|
|
|
@ -1,16 +1,20 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
|
var os = require("os");
|
||||||
|
|
||||||
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');
|
||||||
|
const { GitRevisionPlugin } = require('git-revision-webpack-plugin');
|
||||||
|
const gitRevisionPlugin = new GitRevisionPlugin();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const VERBOSE = Object.getOwnPropertyNames(process.env).includes("VERBOSE") || !true;
|
const VERBOSE = Object.getOwnPropertyNames(process.env).includes("VERBOSE") || !true;
|
||||||
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')
|
let commitHash = gitRevisionPlugin.commithash();
|
||||||
.execSync('git rev-parse --short HEAD')
|
|
||||||
.toString();
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
mode: MODE,
|
mode: MODE,
|
||||||
|
@ -29,7 +33,8 @@ module.exports = {
|
||||||
new MiniCssExtractPlugin(),
|
new MiniCssExtractPlugin(),
|
||||||
new HtmlWebpackPlugin({ title: "VaultUI" }),
|
new HtmlWebpackPlugin({ title: "VaultUI" }),
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
__COMMIT_HASH__: JSON.stringify(commitHash),
|
BUILD_STRING:
|
||||||
|
JSON.stringify(`Built At: ${new Date().toString()} by ${os.userInfo().username}@${os.hostname()} on commit ${commitHash}`),
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
devServer: {
|
devServer: {
|
||||||
|
|
Loading…
Reference in a new issue