Skip to content

Commit

Permalink
Get CLI tools working with rollbar
Browse files Browse the repository at this point in the history
Apply changes from tidepool-org@8e97b0b
  • Loading branch information
Lennart Goedhart committed Mar 26, 2018
1 parent 3d2718b commit e4c31cf
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 38 deletions.
53 changes: 39 additions & 14 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"presets": [
["env", { "targets": { "node": "7.9.0", "electron": "1.7.8" }, "useBuiltIns": true }],
[
"env",
{
"targets": { "node": "7.9.0", "electron": "1.7.8" },
"useBuiltIns": true
}
],
"stage-0",
"react"
],
Expand All @@ -9,30 +15,49 @@
"env": {
"production": {
"presets": ["react-optimize"],
"plugins": ["babel-plugin-dev-expression", "transform-class-properties", "transform-es2015-classes"]
"plugins": [
"babel-plugin-dev-expression",
"transform-class-properties",
"transform-es2015-classes"
]
},
"development": {
"plugins": [
"transform-class-properties",
"transform-es2015-classes"
"transform-es2015-classes",
[
"transform-define",
{
"__VERSION_SHA__": "abcd"
}
]
],
"presets": ["react-hmre"]
},
"test": {
"plugins": [
[ "module-resolver", {
"root": ["./app/node_modules"],
"alias": {
"node-hid": "./app/node_modules/node-hid",
"serialport": "./app/node_modules/serialport"
[
"module-resolver",
{
"root": ["./app/node_modules"],
"alias": {
"node-hid": "./app/node_modules/node-hid",
"serialport": "./app/node_modules/serialport"
}
}
} ],
["webpack-loaders", { "config": "webpack.config.test.js", "verbose": false }],
],
[
"webpack-loaders",
{ "config": "webpack.config.test.js", "verbose": false }
],
"babel-plugin-rewire",
["transform-define", {
"__VERSION_SHA__": "abcd",
"process.env.DEBUG_ERROR": false
}]
[
"transform-define",
{
"__VERSION_SHA__": "abcd",
"process.env.DEBUG_ERROR": false
}
]
]
}
}
Expand Down
52 changes: 28 additions & 24 deletions app/utils/rollbar.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
/* global __VERSION_SHA__ */

import Rollbar from 'rollbar/dist/rollbar.umd';

let rollbar = new Rollbar({
accessToken: '1843589282464f4facd43f794c8201a8',
captureUncaught: true,
enabled: process.env.NODE_ENV === 'production',
payload: {
environment: 'electron_renderer',
client: {
javascript: {
code_version: __VERSION_SHA__,
guess_uncaught_frames: true
let rollbar;

if (process.env.NODE_ENV === 'production') {

rollbar = new Rollbar({
accessToken: '1843589282464f4facd43f794c8201a8',
captureUncaught: true,
enabled: process.env.NODE_ENV === 'production',
payload: {
environment: 'electron_renderer',
client: {
javascript: {
code_version: __VERSION_SHA__,
guess_uncaught_frames: true
}
}
}
},
// to deal with URI's as local filesystem paths, we use the "many domain" transform:
// https://rollbar.com/docs/source-maps/#using-source-maps-on-many-domains
transform: function(payload) {
var trace = payload.body.trace;
if (trace && trace.frames) {
for (var i = 0; i < trace.frames.length; i++) {
var filename = trace.frames[i].filename;
if (filename) {
trace.frames[i].filename = 'http://dynamichost/dist/bundle.js';
},
// to deal with URI's as local filesystem paths, we use the "many domain" transform:
// https://rollbar.com/docs/source-maps/#using-source-maps-on-many-domains
transform: function(payload) {
var trace = payload.body.trace;
if (trace && trace.frames) {
for (var i = 0; i < trace.frames.length; i++) {
var filename = trace.frames[i].filename;
if (filename) {
trace.frames[i].filename = 'http://dynamichost/dist/bundle.js';
}
}
}
}
}
}
);
);
};

export default rollbar;

0 comments on commit e4c31cf

Please sign in to comment.