diff --git a/.eslintrc.json b/.eslintrc.json index 4ec6a87..6d950a3 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -8,6 +8,7 @@ "eslint:recommended", "plugin:react/recommended" ], + "parser": "babel-eslint", "parserOptions": { "ecmaFeatures": { "jsx": true diff --git a/gatsby-browser.js b/gatsby-browser.js index b83ed98..09a1cf8 100644 --- a/gatsby-browser.js +++ b/gatsby-browser.js @@ -1 +1,8 @@ -require('./src/site.css'); +import * as Sentry from '@sentry/browser'; + +import 'site.css'; + +export const onClientEntry = () => { + Sentry.getCurrentHub().getClient().getOptions().enabled = + (navigator.doNotTrack !== '1' && window.doNotTrack !== '1'); +}; diff --git a/gatsby-config.js b/gatsby-config.js index 6b194ba..4ed2f98 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -19,6 +19,15 @@ module.exports = { anonymize: true, respectDNT: true } + }, + { + resolve: 'gatsby-plugin-sentry', + options: { + dsn: process.env.SENTRY_DSN, + environment: process.env.DEPLOY_ENV || process.env.NODE_ENV, + debug: (process.env.NODE_ENV !== 'production'), + release: buildId + } } ] }; diff --git a/package.json b/package.json index dffb3c4..7264d0f 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "gatsby-plugin-google-analytics": "^2.0.8", "gatsby-plugin-postcss": "^2.0.2", "gatsby-plugin-react-helmet": "^3.0.5", + "gatsby-plugin-sentry": "^1.0.0", "postcss-cssnext": "^3.1.0", "postcss-import": "^12.0.1", "prop-types": "^15.6.2", diff --git a/src/components/Layout/index.js b/src/components/Layout/index.js index d4361f1..a64c2eb 100644 --- a/src/components/Layout/index.js +++ b/src/components/Layout/index.js @@ -2,17 +2,20 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Helmet } from 'react-helmet'; +import SentryBoundary from 'components/SentryBoundary'; import Header from 'components/Header'; import Footer from 'components/Footer'; -const Layout = ({ title, children }) => +const Layout = ({ title, children }) => { title ? `Regexper - ${ title }` : 'Regexper' }
- { children } + + { children } +