1
0
Fork 0

Improve BUILD_STRING.

This commit is contained in:
Kitteh 2021-05-09 16:31:01 +01:00
parent 67f9703a33
commit 74092cf62d
4 changed files with 13 additions and 6 deletions

View file

@ -18,7 +18,7 @@
"pageContent": "writable",
"module": "writable",
"process": "writable",
"__COMMIT_HASH__": "writable"
"BUILD_STRING": "writable"
},
"rules": {
"no-unused-vars": [

View file

@ -11,6 +11,7 @@
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
"file-saver": "^2.0.5",
"git-revision-webpack-plugin": "^5.0.0",
"html-webpack-plugin": "^5.3.1",
"i18next": "^20.2.1",
"mini-css-extract-plugin": "^1.4.1",

View file

@ -126,8 +126,9 @@ async function onLoad() {
}
document.addEventListener('DOMContentLoaded', async function () {
console.log("Loading...");
// @ts-expect-error
console.log("Loading Version:", __COMMIT_HASH__);
console.log("Build Data:", BUILD_STRING);
i18next.init({
lng: pageState.language,
fallbackLng: 'en',

View file

@ -1,16 +1,20 @@
const path = require('path');
const webpack = require('webpack');
var os = require("os");
const MiniCssExtractPlugin = require('mini-css-extract-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 MODE = process.env.WEBPACK_MODE || "production"
const DEBUG = MODE != "production";
let commitHash = require('child_process')
.execSync('git rev-parse --short HEAD')
.toString();
let commitHash = gitRevisionPlugin.commithash();
module.exports = {
mode: MODE,
@ -29,7 +33,8 @@ module.exports = {
new MiniCssExtractPlugin(),
new HtmlWebpackPlugin({ title: "VaultUI" }),
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: {