diff --git a/package.json b/package.json index bf295da..314555e 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "npm-run-all": "^4.1.2", "postcss-loader": "^2.1.0", "precss": "^3.1.0", + "raven-js": "^3.22.2", "react": "^16.2.0", "react-dom": "^16.2.0", "react-ga": "^2.4.1", diff --git a/src/components/PageTemplate.js b/src/components/PageTemplate.js index 3f009b8..3604dba 100644 --- a/src/components/PageTemplate.js +++ b/src/components/PageTemplate.js @@ -17,7 +17,7 @@ const PageTemplate = ({ title, children }) => ( Regexper{ title && (' - ' + title) } - +

Regexper diff --git a/src/pages/404/index.js b/src/pages/404/index.js index 5686f4c..d1f308d 100644 --- a/src/pages/404/index.js +++ b/src/pages/404/index.js @@ -1,4 +1,6 @@ import '../../style.css'; import { setupGA } from '../../analytics'; +import { setupRaven } from '../../sentry'; +setupRaven(); setupGA(); diff --git a/src/pages/index/index.js b/src/pages/index/index.js index ebd5b9a..609998d 100644 --- a/src/pages/index/index.js +++ b/src/pages/index/index.js @@ -6,10 +6,12 @@ import App from '../../components/App'; import '../../style.css'; import { setupServiceWorker } from '../../service-worker'; import { setupGA } from '../../analytics'; +import { setupRaven } from '../../sentry'; +setupRaven(); +setupGA(); if (process.env.NODE_ENV === 'production') { setupServiceWorker(); } -setupGA(); ReactDOM.render(, document.getElementById('root')); diff --git a/src/sentry.js b/src/sentry.js new file mode 100644 index 0000000..9c3bf47 --- /dev/null +++ b/src/sentry.js @@ -0,0 +1,12 @@ +import Raven from 'raven-js'; + +const setupRaven = () => { + Raven.config(process.env.SENTRY_KEY, { + whitelistUrls: [/https:\/\/(.*\.)?regexper\.com/], + environment: process.env.NODE_ENV, + debug: (process.env.NODE_ENV !== 'production'), + release: process.env.BUILD_ID + }); +}; + +export { setupRaven }; diff --git a/webpack.common.js b/webpack.common.js index 8e03340..3a69436 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -41,7 +41,12 @@ module.exports = { NODE_ENV: 'development', GA_PROPERTY: null, SENTRY_KEY: null, - BANNER: process.env.NODE_ENV === 'production' ? null : (process.env.NODE_ENV || 'development') + BANNER: process.env.NODE_ENV === 'production' ? null : (process.env.NODE_ENV || 'development'), + BUILD_ID: [ + process.env.CIRCLE_BRANCH || 'prerelease', + process.env.CIRCLE_BUILD_NUM || '##', + (process.env.CIRCLE_SHA1 || 'gitsha').slice(-7) + ].join('-') }), new webpack.optimize.CommonsChunkPlugin({ name: 'common', diff --git a/yarn.lock b/yarn.lock index 2434ca1..b80dedb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6217,6 +6217,10 @@ range-parser@^1.0.3, range-parser@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" +raven-js@^3.22.2: + version "3.22.2" + resolved "https://registry.yarnpkg.com/raven-js/-/raven-js-3.22.2.tgz#85785928ebd664049e54efd0db8ff28da0cbb374" + raw-body@2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.2.tgz#bcd60c77d3eb93cde0050295c3f379389bc88f89"