Browse Source

Integrate sentry - main and renderer side

master
meriadec 7 years ago
parent
commit
0441eea7d7
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 1
      .eslintrc
  2. 1
      .gitignore
  3. 10
      README.md
  4. 3
      flow-defs/globals.js
  5. 9
      package.json
  6. 6
      src/main/index.js
  7. 6
      src/renderer/index.js
  8. 7
      webpack/main.config.js
  9. 4
      webpack/plugins.js
  10. 38
      yarn.lock

1
.eslintrc

@ -6,6 +6,7 @@
"__ENV__": false, "__ENV__": false,
"__DEV__": false, "__DEV__": false,
"__PROD__": false, "__PROD__": false,
"__SENTRY_URL__": false,
"__static": false, "__static": false,
"window": false, "window": false,
}, },

1
.gitignore

@ -6,3 +6,4 @@
/static/ /static/
/storybook-static/ /storybook-static/
thumbs.db thumbs.db
/.env

10
README.md

@ -5,7 +5,15 @@
* nodejs v8.x (https://nodejs.org/en/) * nodejs v8.x (https://nodejs.org/en/)
* yarn latest (https://yarnpkg.com/fr/docs/install) * yarn latest (https://yarnpkg.com/fr/docs/install)
## Installation ## Setup
#### Create .env file and complete it, if you want main & renderer errors to be tracked
```
SENTRY_URL=http://...
```
#### Install dependencies
``` ```
yarn yarn

3
flow-defs/globals.js

@ -1,4 +1,7 @@
/* eslint-disable */
declare var __DEV__: boolean declare var __DEV__: boolean
declare var __PROD__: boolean declare var __PROD__: boolean
declare var __ENV__: string declare var __ENV__: string
declare var __SENTRY_URL__: string
declare var __static: string declare var __static: string

9
package.json

@ -29,8 +29,14 @@
"electronWebpack": { "electronWebpack": {
"renderer": { "renderer": {
"webpackConfig": "./webpack/renderer.config.js" "webpackConfig": "./webpack/renderer.config.js"
},
"main": {
"webpackConfig": "./webpack/main.config.js"
} }
}, },
"resolutions": {
"webpack-sources": "1.0.1"
},
"dependencies": { "dependencies": {
"@ledgerhq/hw-app-btc": "^1.1.2-beta.068e2a14", "@ledgerhq/hw-app-btc": "^1.1.2-beta.068e2a14",
"@ledgerhq/hw-app-eth": "^1.1.2-beta.068e2a14", "@ledgerhq/hw-app-eth": "^1.1.2-beta.068e2a14",
@ -49,6 +55,8 @@
"ledger-wallet-common": "github:LedgerHQ/ledger-wallet-common", "ledger-wallet-common": "github:LedgerHQ/ledger-wallet-common",
"lodash": "^4.17.4", "lodash": "^4.17.4",
"object-path": "^0.11.4", "object-path": "^0.11.4",
"raven": "^2.3.0",
"raven-js": "^3.22.1",
"react": "^16.2.0", "react": "^16.2.0",
"react-dom": "^16.2.0", "react-dom": "^16.2.0",
"react-i18next": "^7.3.1", "react-i18next": "^7.3.1",
@ -81,6 +89,7 @@
"babel-preset-react": "^6.24.1", "babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1", "babel-preset-stage-0": "^6.24.1",
"concurrently": "^3.5.1", "concurrently": "^3.5.1",
"dotenv": "^4.0.0",
"electron": "1.7.10", "electron": "1.7.10",
"electron-builder": "^19.54.0", "electron-builder": "^19.54.0",
"electron-devtools-installer": "^2.2.3", "electron-devtools-installer": "^2.2.3",

6
src/main/index.js

@ -3,3 +3,9 @@
require('../globals') require('../globals')
require('./bridge') require('./bridge')
require('./app') require('./app')
if (__PROD__ && __SENTRY_URL__) {
const Raven = require('raven') // eslint-disable-line global-require
const ravenConfig = { captureUnhandledRejections: true }
Raven.config(__SENTRY_URL__, ravenConfig).install()
}

6
src/renderer/index.js

@ -1,6 +1,7 @@
// @flow // @flow
import React from 'react' import React from 'react'
import Raven from 'raven-js'
import { render } from 'react-dom' import { render } from 'react-dom'
import { AppContainer } from 'react-hot-loader' import { AppContainer } from 'react-hot-loader'
import createHistory from 'history/createHashHistory' import createHistory from 'history/createHashHistory'
@ -16,6 +17,11 @@ import App from 'components/App'
import 'styles/global' import 'styles/global'
if (__PROD__ && __SENTRY_URL__) {
Raven.config(__SENTRY_URL__).install()
window.addEventListener('unhandledrejection', event => Raven.captureException(event.reason))
}
const history = createHistory() const history = createHistory()
const store = createStore(history) const store = createStore(history)
const rootNode = document.getElementById('app') const rootNode = document.getElementById('app')

7
webpack/main.config.js

@ -0,0 +1,7 @@
const plugins = require('./plugins')
const config = {
plugins,
}
module.exports = config

4
webpack/plugins.js

@ -1,3 +1,4 @@
require('dotenv').config()
const webpack = require('webpack') const webpack = require('webpack')
require('../src/globals') require('../src/globals')
@ -6,6 +7,7 @@ module.exports = [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
__DEV__, __DEV__,
__PROD__, __PROD__,
'process.env.NODE_ENV': `"${__ENV__}"`, __SENTRY_URL__: JSON.stringify(process.env.SENTRY_URL),
'process.env.NODE_ENV': JSON.stringify(__ENV__),
}), }),
] ]

38
yarn.lock

@ -5667,6 +5667,10 @@ lru-cache@^4.0.1, lru-cache@^4.1.1:
pseudomap "^1.0.2" pseudomap "^1.0.2"
yallist "^2.1.2" yallist "^2.1.2"
lsmod@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/lsmod/-/lsmod-1.0.0.tgz#9a00f76dca36eb23fa05350afe1b585d4299e64b"
macaddress@^0.2.8: macaddress@^0.2.8:
version "0.2.8" version "0.2.8"
resolved "https://registry.yarnpkg.com/macaddress/-/macaddress-0.2.8.tgz#5904dc537c39ec6dbefeae902327135fa8511f12" resolved "https://registry.yarnpkg.com/macaddress/-/macaddress-0.2.8.tgz#5904dc537c39ec6dbefeae902327135fa8511f12"
@ -7146,6 +7150,20 @@ range-parser@^1.0.3, range-parser@~1.2.0:
version "1.2.0" version "1.2.0"
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e"
raven-js@^3.22.1:
version "3.22.1"
resolved "https://registry.yarnpkg.com/raven-js/-/raven-js-3.22.1.tgz#1117f00dfefaa427ef6e1a7d50bbb1fb998a24da"
raven@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/raven/-/raven-2.3.0.tgz#96f15346bdaa433b3b6d47130804506155833d69"
dependencies:
cookie "0.3.1"
lsmod "1.0.0"
stack-trace "0.0.9"
timed-out "4.0.1"
uuid "3.0.0"
raw-body@2.3.2: raw-body@2.3.2:
version "2.3.2" version "2.3.2"
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.2.tgz#bcd60c77d3eb93cde0050295c3f379389bc88f89" resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.2.tgz#bcd60c77d3eb93cde0050295c3f379389bc88f89"
@ -8196,7 +8214,7 @@ source-map@0.5.6:
version "0.5.6" version "0.5.6"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412"
source-map@0.5.x, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.0, source-map@~0.5.1: source-map@0.5.x, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.0, source-map@~0.5.1, source-map@~0.5.3:
version "0.5.7" version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
@ -8285,6 +8303,10 @@ ssri@^5.0.0:
dependencies: dependencies:
safe-buffer "^5.1.0" safe-buffer "^5.1.0"
stack-trace@0.0.9:
version "0.0.9"
resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.9.tgz#a8f6eaeca90674c333e7c43953f275b451510695"
stackframe@^0.3.1: stackframe@^0.3.1:
version "0.3.1" version "0.3.1"
resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-0.3.1.tgz#33aa84f1177a5548c8935533cbfeb3420975f5a4" resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-0.3.1.tgz#33aa84f1177a5548c8935533cbfeb3420975f5a4"
@ -8659,7 +8681,7 @@ time-stamp@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-2.0.0.tgz#95c6a44530e15ba8d6f4a3ecb8c3a3fac46da357" resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-2.0.0.tgz#95c6a44530e15ba8d6f4a3ecb8c3a3fac46da357"
timed-out@^4.0.0: timed-out@4.0.1, timed-out@^4.0.0:
version "4.0.1" version "4.0.1"
resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f"
@ -9013,6 +9035,10 @@ utils-merge@1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
uuid@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.0.tgz#6728fc0459c450d796a99c31837569bdf672d728"
uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0: uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0:
version "3.2.1" version "3.2.1"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14"
@ -9148,12 +9174,12 @@ webpack-merge@^4.1.0:
dependencies: dependencies:
lodash "^4.17.4" lodash "^4.17.4"
webpack-sources@^1.0.1, webpack-sources@^1.1.0: webpack-sources@1.0.1, webpack-sources@^1.0.1, webpack-sources@^1.1.0:
version "1.1.0" version "1.0.1"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.1.0.tgz#a101ebae59d6507354d71d8013950a3a8b7a5a54" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.0.1.tgz#c7356436a4d13123be2e2426a05d1dad9cbe65cf"
dependencies: dependencies:
source-list-map "^2.0.0" source-list-map "^2.0.0"
source-map "~0.6.1" source-map "~0.5.3"
webpack@^3.10.0: webpack@^3.10.0:
version "3.10.0" version "3.10.0"

Loading…
Cancel
Save