From c9ec9e4438da0b6d6ee48dfcf15e2fe9d38f537a Mon Sep 17 00:00:00 2001 From: Vladimir Volek Date: Thu, 20 Sep 2018 13:56:24 +0200 Subject: [PATCH] Added commit hash to footer --- .eslintrc | 3 +++ package.json | 1 + src/components/Footer/index.js | 2 +- webpack/dev.babel.js | 6 +++++- webpack/production.babel.js | 6 ++++++ yarn.lock | 4 ++++ 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.eslintrc b/.eslintrc index bbe3a8a7..5c87b414 100644 --- a/.eslintrc +++ b/.eslintrc @@ -4,6 +4,9 @@ "plugin:flowtype/recommended", "plugin:jest/recommended" ], + "globals": { + "COMMITHASH": true + }, "env": { "browser": true, "jest": true diff --git a/package.json b/package.json index d920fb90..cca0a91d 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "ethereumjs-tx": "^1.3.3", "ethereumjs-units": "^0.2.0", "ethereumjs-util": "^5.1.4", + "git-revision-webpack-plugin": "^3.0.3", "hdkey": "^0.8.0", "html-webpack-plugin": "^3.2.0", "npm-run-all": "^4.1.3", diff --git a/src/components/Footer/index.js b/src/components/Footer/index.js index fa695d98..8f19462c 100644 --- a/src/components/Footer/index.js +++ b/src/components/Footer/index.js @@ -29,7 +29,7 @@ const Copy = styled.div` const Footer = ({ toggle }) => ( - © {getYear(new Date())} + © {getYear(new Date())} SatoshiLabs Terms Show Log diff --git a/webpack/dev.babel.js b/webpack/dev.babel.js index 377bb513..42da5afb 100644 --- a/webpack/dev.babel.js +++ b/webpack/dev.babel.js @@ -1,5 +1,5 @@ import webpack from 'webpack'; - +import GitRevisionPlugin from 'git-revision-webpack-plugin'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; @@ -7,6 +7,7 @@ import { SRC, BUILD, PORT, PUBLIC, } from './constants'; +const gitRevisionPlugin = new GitRevisionPlugin(); module.exports = { watch: true, @@ -89,6 +90,9 @@ module.exports = { hints: false, }, plugins: [ + new webpack.DefinePlugin({ + COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash()), + }), new HtmlWebpackPlugin({ chunks: ['index'], template: `${SRC}index.html`, diff --git a/webpack/production.babel.js b/webpack/production.babel.js index 39342d6b..3761cec3 100644 --- a/webpack/production.babel.js +++ b/webpack/production.babel.js @@ -1,9 +1,12 @@ import webpack from 'webpack'; +import GitRevisionPlugin from 'git-revision-webpack-plugin'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import CopyWebpackPlugin from 'copy-webpack-plugin'; import { SRC, BUILD, PUBLIC } from './constants'; +const gitRevisionPlugin = new GitRevisionPlugin(); + module.exports = { mode: 'production', entry: { @@ -60,6 +63,9 @@ module.exports = { hints: false, }, plugins: [ + new webpack.DefinePlugin({ + COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash()), + }), new HtmlWebpackPlugin({ chunks: ['index'], template: `${SRC}index.html`, diff --git a/yarn.lock b/yarn.lock index 0aeaea58..af3c54fa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4519,6 +4519,10 @@ gh-got@^6.0.0: got "^7.0.0" is-plain-obj "^1.1.0" +git-revision-webpack-plugin@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/git-revision-webpack-plugin/-/git-revision-webpack-plugin-3.0.3.tgz#f909949d7851d1039ed530518f73f5d46594e66f" + github-username@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/github-username/-/github-username-4.1.0.tgz#cbe280041883206da4212ae9e4b5f169c30bf417"