aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/instant/.dogfood.discharge.json4
-rw-r--r--packages/instant/.staging.discharge.json4
-rw-r--r--packages/instant/package.json3
-rw-r--r--packages/instant/webpack.config.js63
-rw-r--r--yarn.lock15
5 files changed, 74 insertions, 15 deletions
diff --git a/packages/instant/.dogfood.discharge.json b/packages/instant/.dogfood.discharge.json
index ca36b3861..cea579c27 100644
--- a/packages/instant/.dogfood.discharge.json
+++ b/packages/instant/.dogfood.discharge.json
@@ -1,12 +1,12 @@
{
"domain": "0x-instant-dogfood",
- "build_command": "WEBPACK_OUTPUT_PATH=public yarn build:umd:prod",
+ "build_command": "WEBPACK_OUTPUT_PATH=public yarn build:umd:prod --env.dogfood",
"upload_directory": "public",
"index_key": "index.html",
"error_key": "index.html",
"trailing_slashes": true,
"cache": 3600,
- "aws_profile": "default",
+ "aws_profile": "0xproject",
"aws_region": "us-east-1",
"cdn": false,
"dns_configured": true
diff --git a/packages/instant/.staging.discharge.json b/packages/instant/.staging.discharge.json
index c917a650b..9e63cb110 100644
--- a/packages/instant/.staging.discharge.json
+++ b/packages/instant/.staging.discharge.json
@@ -1,12 +1,12 @@
{
"domain": "0x-instant-staging",
- "build_command": "WEBPACK_OUTPUT_PATH=public yarn build:umd:prod",
+ "build_command": "WEBPACK_OUTPUT_PATH=public yarn build:umd:prod --env.staging",
"upload_directory": "public",
"index_key": "index.html",
"error_key": "index.html",
"trailing_slashes": true,
"cache": 3600,
- "aws_profile": "default",
+ "aws_profile": "0xproject",
"aws_region": "us-east-1",
"cdn": false,
"dns_configured": true
diff --git a/packages/instant/package.json b/packages/instant/package.json
index 1813d61e5..e613e028c 100644
--- a/packages/instant/package.json
+++ b/packages/instant/package.json
@@ -64,6 +64,7 @@
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-devtools-extension": "^2.13.5",
+ "rollbar": "^2.5.0",
"styled-components": "^4.0.2",
"ts-optchain": "^0.1.1"
},
@@ -88,7 +89,9 @@
"make-promises-safe": "^1.1.0",
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
+ "rollbar-sourcemap-webpack-plugin": "^2.4.0",
"shx": "^0.2.2",
+ "source-map-loader": "^0.2.4",
"svg-react-loader": "^0.4.6",
"ts-jest": "^23.10.3",
"tslint": "5.11.0",
diff --git a/packages/instant/webpack.config.js b/packages/instant/webpack.config.js
index 161e7d1b0..2375bbd31 100644
--- a/packages/instant/webpack.config.js
+++ b/packages/instant/webpack.config.js
@@ -1,6 +1,7 @@
const childProcess = require('child_process');
const ip = require('ip');
const path = require('path');
+const RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin');
const webpack = require('webpack');
// The common js bundle (not this one) is built using tsc.
@@ -34,9 +35,59 @@ const getHeapAnalyticsId = environmentName => {
return undefined;
};
+const getRollbarPlugin = environmentName => {
+ if (!environmentName) {
+ return undefined;
+ }
+
+ const publishToken = process.env.INSTANT_ROLLBAR_PUBLISH_TOKEN;
+ if (!publishToken) {
+ return undefined;
+ }
+
+ let rollbarPublicPath;
+ if (environmentName === 'dogfood') {
+ rollbarPublicPath = 'http://0x-instant-dogfood.s3-website-us-east-1.amazonaws.com';
+ } else if (environmentName === 'staging') {
+ rollbarPublicPath = 'http://0x-instant-staging.s3-website-us-east-1.amazonaws.com';
+ }
+
+ if (!rollbarPublicPath) {
+ console.log('No rollbar public path');
+ return undefined;
+ }
+
+ const rollbarPluginOptions = {
+ accessToken: publishToken,
+ version: GIT_SHA,
+ publicPath: rollbarPublicPath,
+ };
+ return new RollbarSourceMapPlugin(rollbarPluginOptions);
+};
+
module.exports = (env, argv) => {
const environmentName = getEnvironmentName(env, argv);
const outputPath = process.env.WEBPACK_OUTPUT_PATH || 'umd';
+
+ let plugins = [
+ new webpack.DefinePlugin({
+ 'process.env': {
+ GIT_SHA: JSON.stringify(GIT_SHA),
+ NPM_PACKAGE_VERSION: JSON.stringify(process.env.npm_package_version),
+ HEAP_ANALYTICS_ID: getHeapAnalyticsId(environmentName),
+ ROLLBAR_ENVIRONMENT: JSON.stringify(environmentName),
+ ROLLBAR_CLIENT_TOKEN: JSON.stringify(process.env.INSTANT_ROLLBAR_CLIENT_TOKEN),
+ },
+ }),
+ ];
+ const rollbarPlugin = getRollbarPlugin(environmentName);
+ if (rollbarPlugin) {
+ console.log('Using rollbar plugin');
+ plugins = plugins.concat(rollbarPlugin);
+ } else {
+ console.log('Not using rollbar plugin');
+ }
+
const config = {
entry: {
instant: './src/index.umd.ts',
@@ -47,17 +98,7 @@ module.exports = (env, argv) => {
library: 'zeroExInstant',
libraryTarget: 'umd',
},
- plugins: [
- new webpack.DefinePlugin({
- 'process.env': {
- GIT_SHA: JSON.stringify(GIT_SHA),
- NPM_PACKAGE_VERSION: JSON.stringify(process.env.npm_package_version),
- HEAP_ANALYTICS_ID: getHeapAnalyticsId(environmentName),
- ROLLBAR_ENVIRONMENT: JSON.stringify(environmentName),
- ROLLBAR_CLIENT_TOKEN: JSON.stringify(process.env.INSTANT_ROLLBAR_CLIENT_TOKEN),
- },
- }),
- ],
+ plugins,
devtool: 'source-map',
resolve: {
extensions: ['.js', '.json', '.ts', '.tsx'],
diff --git a/yarn.lock b/yarn.lock
index a7a55a7b3..f9d036292 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -13367,6 +13367,21 @@ rollbar@^2.4.7:
optionalDependencies:
decache "^3.0.5"
+rollbar@^2.5.0:
+ version "2.5.0"
+ resolved "https://registry.yarnpkg.com/rollbar/-/rollbar-2.5.0.tgz#dbb513eea34f1e3bae57611810c3e6df0ef50a12"
+ dependencies:
+ async "~1.2.1"
+ console-polyfill "0.3.0"
+ debug "2.6.9"
+ error-stack-parser "1.3.3"
+ json-stringify-safe "~5.0.0"
+ lru-cache "~2.2.1"
+ request-ip "~2.0.1"
+ uuid "3.0.x"
+ optionalDependencies:
+ decache "^3.0.5"
+
rst-selector-parser@^2.2.3:
version "2.2.3"
resolved "https://registry.npmjs.org/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz#81b230ea2fcc6066c89e3472de794285d9b03d91"