commit 743aec5a8aaeea4c7ca1663139602d6cfb1a6e78
parent 8b190749d612287a803811cea977cb510cd3bcff
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Sat, 18 Mar 2017 14:49:07 +0300
add git commit to sentry errors
Diffstat:
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js
@@ -249,7 +249,10 @@ module.exports = {
return module.resource && (/node_modules|vendored/).test(module.resource)
},
}),
- new webpack.DefinePlugin({'NODE_ENV': JSON.stringify(process.env.NODE_ENV)}),
+ new webpack.DefinePlugin({
+ 'NODE_ENV': JSON.stringify(process.env.NODE_ENV),
+ 'RELEASE_VER': JSON.stringify(process.env.RELEASE_VER),
+ }),
],
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
diff --git a/scripts/build.js b/scripts/build.js
@@ -1,6 +1,11 @@
// Do this as the first thing so that any code reading it knows the right env.
process.env.NODE_ENV = 'production';
+var execSync = require('child_process').execSync;
+var verCmd = "echo `date +%Y-%m-%d_%H:%M:%S`-`git rev-parse --abbrev-ref HEAD`-`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`";
+var version = execSync(verCmd).toString();
+console.log('Version:', version);
+process.env.RELEASE_VER = version;
// Load environment variables from .env file. Suppress warnings using silent
// if this file is missing. dotenv will never modify any environment variables
// that have already been set.
diff --git a/src/index.js b/src/index.js
@@ -5,8 +5,8 @@ import config from './config';
/* eslint-disable no-undef */
if (NODE_ENV === 'production') {
+ Raven.config(config.sentryDSN, {release: RELEASE_VER}).install();
/* eslint-enable no-undef */
- Raven.config(config.sentryDSN).install();
}
const oldOnunhandledrejection = window.onunhandledrejection;