Skip to content

Commit

Permalink
Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
samdenty committed May 12, 2018
1 parent 278d949 commit 5d762b7
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@cerebral/router": "^3.2.2",
"@types/highlight.js": "^9.12.2",
"@types/lodash": "^4.14.108",
"@types/raven-js": "^3.10.0",
"@types/react-notification-system": "^0.2.37",
"@types/recompose": "^0.26.1",
"@types/socket.io-client": "^1.4.32",
Expand Down
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<meta name="referrer" content="no-referrer">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<script src="https://cdn.ravenjs.com/3.25.1/raven.min.js" crossorigin="anonymous"></script>
</head>

<body>
Expand Down
3 changes: 2 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import './res/index.css'

import { Container } from '@cerebral/react'
import { connect } from 'raven'
import * as React from 'react'
import * as ReactDOM from 'react-dom'

Expand All @@ -9,7 +10,6 @@ import ThemeProvider from './app/ThemeProvider'
import controller from './controllers/cerebral'
import registerServiceWorker from './registerServiceWorker'


// Render App
ReactDOM.render(
<Container controller={controller}>
Expand All @@ -21,6 +21,7 @@ ReactDOM.render(
)

registerServiceWorker()
connect()

// Hot reloading
declare const module: any
Expand Down
22 changes: 22 additions & 0 deletions src/modules/sentry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { RavenStatic } from 'raven-js'

declare const Raven: RavenStatic

const { version } = require('../../package.json')
const token = 'https://[email protected]/1205518'

export function R(callback: (RavenStatic) => any) {
if (Raven) callback(Raven)
}

export function connect() {
R(Raven => {
Raven.config(token, {
environment: process.env.NODE_ENV,
release: `${version}`,
tags: { version }
}).install()
})
}

export default Raven
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"baseUrl": ".",
"paths": {
"logger": ["src/modules/logger.ts"],
"raven": ["src/modules/sentry.ts"],
"notify": ["src/app/notify.tsx"],
"styled-elements/*": ["src/modules/styled-elements/*"],
"typed-emotion": ["src/controllers/emotion/index.ts"],
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@
version "9.6.7"
resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.7.tgz#5f3816d1db2155edcde1b2e3aa5d0e5c520cb564"

"@types/raven-js@^3.10.0":
version "3.10.0"
resolved "https://registry.yarnpkg.com/@types/raven-js/-/raven-js-3.10.0.tgz#d0832162ebea7671eafff08a324b56adde5bf9c3"
dependencies:
raven-js "*"

"@types/react-dom@^16.0.5":
version "16.0.5"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.0.5.tgz#a757457662e3819409229e8f86795ff37b371f96"
Expand Down Expand Up @@ -6077,6 +6083,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@*:
version "3.25.1"
resolved "https://registry.yarnpkg.com/raven-js/-/raven-js-3.25.1.tgz#05df39b41af140e3b2fa34e2c522e2b4f99a98be"

[email protected]:
version "2.3.2"
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.2.tgz#bcd60c77d3eb93cde0050295c3f379389bc88f89"
Expand Down

0 comments on commit 5d762b7

Please sign in to comment.