1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-12-26 00:48:35 +00:00

Added separated dev build with sentry.io

This commit is contained in:
Vladimir Volek 2018-09-19 16:55:09 +02:00
parent 4ea7f68250
commit 93d3ccbd3a
7 changed files with 29 additions and 13 deletions

View File

@ -1,4 +1,6 @@
public public
build
build-devel
coverage coverage
images images
node_modules node_modules

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
build build
build-devel
# Dependency directory # Dependency directory
node_modules node_modules

View File

@ -10,8 +10,9 @@
"scripts": { "scripts": {
"dev": "npx webpack-dev-server --config ./webpack/dev.babel.js", "dev": "npx webpack-dev-server --config ./webpack/dev.babel.js",
"dev:local": "npx webpack-dev-server --config ./webpack/local.babel.js", "dev:local": "npx webpack-dev-server --config ./webpack/local.babel.js",
"build:clean": "rm -rf build", "build:clean": "rimraf build build-devel",
"build:production": "npx webpack --config ./webpack/production.babel.js --progress --bail", "build:production": "npx webpack --config ./webpack/production.babel.js --progress --bail",
"build:dev": "cross-env BUILD=development npx webpack --config ./webpack/production.babel.js --output-path build-devel --progress --bail",
"build": "run-s build:*", "build": "run-s build:*",
"flow": "flow check src", "flow": "flow check src",
"lint": "run-s lint:*", "lint": "run-s lint:*",
@ -27,6 +28,7 @@
"bignumber.js": "2.4.0", "bignumber.js": "2.4.0",
"color-hash": "^1.0.3", "color-hash": "^1.0.3",
"copy-webpack-plugin": "^4.5.2", "copy-webpack-plugin": "^4.5.2",
"cross-env": "^5.2.0",
"date-fns": "^1.29.0", "date-fns": "^1.29.0",
"ethereumjs-tx": "^1.3.3", "ethereumjs-tx": "^1.3.3",
"ethereumjs-units": "^0.2.0", "ethereumjs-units": "^0.2.0",
@ -54,6 +56,7 @@
"redux-logger": "^3.0.6", "redux-logger": "^3.0.6",
"redux-raven-middleware": "^1.2.0", "redux-raven-middleware": "^1.2.0",
"redux-thunk": "^2.2.0", "redux-thunk": "^2.2.0",
"rimraf": "^2.6.2",
"styled-components": "^3.3.3", "styled-components": "^3.3.3",
"styled-media-query": "^2.0.2", "styled-media-query": "^2.0.2",
"styled-normalize": "^8.0.0", "styled-normalize": "^8.0.0",

View File

@ -3,8 +3,6 @@
import { createStore, applyMiddleware, compose } from 'redux'; import { createStore, applyMiddleware, compose } from 'redux';
import { routerMiddleware } from 'react-router-redux'; import { routerMiddleware } from 'react-router-redux';
import thunk from 'redux-thunk'; import thunk from 'redux-thunk';
// import createHistory from 'history/createBrowserHistory';
// import { useRouterHistory } from 'react-router';
import createHistory from 'history/createHashHistory'; import createHistory from 'history/createHashHistory';
import { createLogger } from 'redux-logger'; import { createLogger } from 'redux-logger';
import reducers from 'reducers'; import reducers from 'reducers';
@ -17,17 +15,21 @@ import type { Action, GetState, Store } from 'flowtype';
export const history: History = createHistory({ queryKey: false }); export const history: History = createHistory({ queryKey: false });
const RAVEN_KEY: string = 'https://497392c3ff6e46dc9e54eef123979378@sentry.io/294339';
Raven.config(RAVEN_KEY).install();
const initialState: any = {}; const initialState: any = {};
const enhancers = []; const enhancers = [];
const middleware = [
const middlewares = [
thunk, thunk,
RavenMiddleware(RAVEN_KEY),
routerMiddleware(history), routerMiddleware(history),
]; ];
// sentry io middleware only in dev build
if (process.env.BUILD === 'development') {
const RAVEN_KEY = 'https://34b8c09deb6c4cd2a4dc3f0029cd02d8@sentry.io/1279550';
const ravenMiddleware = RavenMiddleware(RAVEN_KEY);
Raven.config(RAVEN_KEY).install();
middlewares.push(ravenMiddleware);
}
let composedEnhancers: any; let composedEnhancers: any;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
@ -50,13 +52,12 @@ if (process.env.NODE_ENV === 'development') {
} }
composedEnhancers = compose( composedEnhancers = compose(
applyMiddleware(logger, ...middleware, ...services), applyMiddleware(logger, ...middlewares, ...services),
...enhancers, ...enhancers,
); );
} else { } else {
composedEnhancers = compose( composedEnhancers = compose(
applyMiddleware(...middleware, ...services), applyMiddleware(...middlewares, ...services),
...enhancers, ...enhancers,
); );
} }

View File

@ -7,7 +7,6 @@ import {
SRC, BUILD, PORT, PUBLIC, SRC, BUILD, PORT, PUBLIC,
} from './constants'; } from './constants';
module.exports = { module.exports = {
watch: true, watch: true,
mode: 'development', mode: 'development',

View File

@ -60,6 +60,9 @@ module.exports = {
hints: false, hints: false,
}, },
plugins: [ plugins: [
new webpack.DefinePlugin({
'process.env.BUILD': JSON.stringify(process.env.BUILD),
}),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
chunks: ['index'], chunks: ['index'],
template: `${SRC}index.html`, template: `${SRC}index.html`,

View File

@ -2799,6 +2799,13 @@ create-hmac@^1.1.4:
safe-buffer "^5.0.1" safe-buffer "^5.0.1"
sha.js "^2.4.8" sha.js "^2.4.8"
cross-env@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.2.0.tgz#6ecd4c015d5773e614039ee529076669b9d126f2"
dependencies:
cross-spawn "^6.0.5"
is-windows "^1.0.0"
cross-spawn@^4.0.0: cross-spawn@^4.0.0:
version "4.0.2" version "4.0.2"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41"
@ -5551,7 +5558,7 @@ is-whitespace-character@^1.0.0:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/is-whitespace-character/-/is-whitespace-character-1.0.2.tgz#ede53b4c6f6fb3874533751ec9280d01928d03ed" resolved "https://registry.yarnpkg.com/is-whitespace-character/-/is-whitespace-character-1.0.2.tgz#ede53b4c6f6fb3874533751ec9280d01928d03ed"
is-windows@^1.0.1, is-windows@^1.0.2: is-windows@^1.0.0, is-windows@^1.0.1, is-windows@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"