From 638dcc66ce455192118ae49e12f7ead4c2fcf50b Mon Sep 17 00:00:00 2001 From: iapyang Date: Tue, 9 Aug 2022 14:26:00 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=89=93=E5=8C=85=E5=8A=A0=E4=B8=8Aha?= =?UTF-8?q?sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webpack/webpack.prod.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/webpack/webpack.prod.js b/webpack/webpack.prod.js index 1af08c2af..89b7f18c8 100644 --- a/webpack/webpack.prod.js +++ b/webpack/webpack.prod.js @@ -12,6 +12,15 @@ const common = require("./webpack.common.js"); const attachments = require("./attachments"); const components = require("./components"); +const childProcess = require('child_process'); + +function git(command) { + return childProcess + .execSync(`git ${command}`) + .toString() + .trim(); +} + module.exports = merge.smart(common, { mode: "production", entry: { @@ -63,7 +72,11 @@ module.exports = merge.smart(common, { } }), new webpack.BannerPlugin({ - banner: `time: ${new Date().toLocaleString()}` + banner: `time: ${new Date().toLocaleString()}; branch: ${git( + 'rev-parse --abbrev-ref HEAD' + )} commit: ${git( + 'rev-parse HEAD' + )}` }) ] },