From c8bb21d12d6acb3fa76a8d3b22b1cbab3ea63ef8 Mon Sep 17 00:00:00 2001 From: fragosti Date: Mon, 9 Jul 2018 14:26:05 -0700 Subject: Add sourcemaps for rollbar --- packages/website/package.json | 1 + packages/website/ts/components/ui/simple_menu.tsx | 2 +- packages/website/ts/utils/error_reporter.ts | 8 ++++ packages/website/webpack.config.js | 13 ++++++ yarn.lock | 49 ++++++++++++++++++++++- 5 files changed, 70 insertions(+), 3 deletions(-) diff --git a/packages/website/package.json b/packages/website/package.json index a3ca047fa..332857dd3 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -92,6 +92,7 @@ "less-loader": "^2.2.3", "make-promises-safe": "^1.1.0", "raw-loader": "^0.5.1", + "rollbar-sourcemap-webpack-plugin": "^2.3.0", "shx": "^0.2.2", "source-map-loader": "^0.1.6", "style-loader": "0.13.x", diff --git a/packages/website/ts/components/ui/simple_menu.tsx b/packages/website/ts/components/ui/simple_menu.tsx index 74b8ef6ae..dcbc6946b 100644 --- a/packages/website/ts/components/ui/simple_menu.tsx +++ b/packages/website/ts/components/ui/simple_menu.tsx @@ -84,5 +84,5 @@ export interface DifferentWalletSimpleMenuItemProps { export const DifferentWalletSimpleMenuItem: React.StatelessComponent = ({ onClick, }) => { - return ; + return ; }; diff --git a/packages/website/ts/utils/error_reporter.ts b/packages/website/ts/utils/error_reporter.ts index f875141fe..83710b81f 100644 --- a/packages/website/ts/utils/error_reporter.ts +++ b/packages/website/ts/utils/error_reporter.ts @@ -13,6 +13,14 @@ const rollbarConfig = { maxItems: 500, payload: { environment: configs.ENVIRONMENT, + client: { + javascript: { + source_map_enabled: true, + // This is only defined in production environments. + code_version: process.env.GIT_SHA, + guess_uncaught_frames: true, + }, + }, }, uncaughtErrorLevel: 'error', hostWhiteList: [configs.DOMAIN_PRODUCTION, configs.DOMAIN_STAGING], diff --git a/packages/website/webpack.config.js b/packages/website/webpack.config.js index b5e9cf6dd..1326769e3 100644 --- a/packages/website/webpack.config.js +++ b/packages/website/webpack.config.js @@ -1,6 +1,13 @@ const path = require('path'); const webpack = require('webpack'); const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); +const RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin'); +const childProcess = require('child_process'); + +const GIT_SHA = childProcess + .execSync('git rev-parse HEAD') + .toString() + .trim(); module.exports = { entry: ['./ts/index.tsx'], @@ -80,6 +87,7 @@ module.exports = { new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify(process.env.NODE_ENV), + GIT_SHA: GIT_SHA, }, }), // TODO: Revert to webpack bundled version with webpack v4. @@ -92,6 +100,11 @@ module.exports = { }, }, }), + new RollbarSourceMapPlugin({ + accessToken: 'a6619002b51c4464928201e6ea94de65', + version: GIT_SHA, + publicPath: 'https://0xproject.com/', + }), ] : [], }; diff --git a/yarn.lock b/yarn.lock index 20689e7aa..9c373aaa5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7421,7 +7421,11 @@ lodash.escaperegexp@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz#64762c48618082518ac3df4ccf5d5886dae20347" -lodash.foreach@^4.5.0: +lodash.find@^4.3.0: + version "4.6.0" + resolved "https://registry.npmjs.org/lodash.find/-/lodash.find-4.6.0.tgz#cb0704d47ab71789ffa0de8b97dd926fb88b13b1" + +lodash.foreach@^4.2.0, lodash.foreach@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.foreach/-/lodash.foreach-4.5.0.tgz#1a6a35eace401280c7f06dddec35165ab27e3e53" @@ -7453,6 +7457,10 @@ lodash.merge@^4.6.0: version "4.6.1" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.1.tgz#adc25d9cb99b9391c59624f379fbba60d7111d54" +lodash.reduce@^4.3.0: + version "4.6.0" + resolved "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz#f1ab6b839299ad48f784abbf476596f03b914d3b" + lodash.restparam@^3.0.0: version "3.6.1" resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" @@ -10374,6 +10382,31 @@ request@^2.54.0, request@^2.67.0, request@^2.79.0: tunnel-agent "^0.6.0" uuid "^3.1.0" +request@^2.85.0: + version "2.87.0" + resolved "https://registry.npmjs.org/request/-/request-2.87.0.tgz#32f00235cd08d482b4d0d68db93a829c0ed5756e" + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.6.0" + caseless "~0.12.0" + combined-stream "~1.0.5" + extend "~3.0.1" + forever-agent "~0.6.1" + form-data "~2.3.1" + har-validator "~5.0.3" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.17" + oauth-sign "~0.8.2" + performance-now "^2.1.0" + qs "~6.5.1" + safe-buffer "^5.1.1" + tough-cookie "~2.3.3" + tunnel-agent "^0.6.0" + uuid "^3.1.0" + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -10525,6 +10558,18 @@ rlp@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.0.0.tgz#9db384ff4b89a8f61563d92395d8625b18f3afb0" +rollbar-sourcemap-webpack-plugin@^2.3.0: + version "2.3.0" + resolved "https://registry.npmjs.org/rollbar-sourcemap-webpack-plugin/-/rollbar-sourcemap-webpack-plugin-2.3.0.tgz#47176fd6441d1ce17b4d3c7e9c9cf7f2076b0485" + dependencies: + async "^2.6.0" + babel-runtime "^6.26.0" + lodash.find "^4.3.0" + lodash.foreach "^4.2.0" + lodash.reduce "^4.3.0" + request "^2.85.0" + verror "^1.6.1" + rollbar@^0.6.5: version "0.6.6" resolved "https://registry.yarnpkg.com/rollbar/-/rollbar-0.6.6.tgz#8630cff4af967667d06b227f243635ea86dcc5ba" @@ -12614,7 +12659,7 @@ vendors@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/vendors/-/vendors-1.0.1.tgz#37ad73c8ee417fb3d580e785312307d274847f22" -verror@1.10.0: +verror@1.10.0, verror@^1.6.1: version "1.10.0" resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" dependencies: -- cgit v1.2.3