diff --git a/.gitignore b/.gitignore index 32c7ed74..4096e09a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ build -build-devel +build-beta +build-dev # Dependency directory node_modules diff --git a/package.json b/package.json index 2cc494e0..781465d3 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "dev": "npx webpack-dev-server --config webpack/dev.babel.js", "dev:local": "npx webpack-dev-server --config webpack/local.babel.js", "build:prod": "rimraf build && npx webpack --config webpack/production.babel.js --progress --bail", - "build:dev": "rimraf build-devel && cross-env BUILD=development npx webpack --config webpack/production.babel.js --output-path build-devel --progress --bail", + "build:beta": "rimraf build-beta && cross-env BUILD=beta npx webpack --config webpack/production.babel.js --output-path build-beta --progress --bail", + "build:dev": "rimraf build-dev && cross-env BUILD=development npx webpack --config webpack/production.babel.js --output-path build-dev --progress --bail", "build": "run-s build:*", "flow": "flow check src", "lint": "run-s lint:*", diff --git a/src/actions/LocalStorageActions.js b/src/actions/LocalStorageActions.js index 68439803..d7d32a1f 100644 --- a/src/actions/LocalStorageActions.js +++ b/src/actions/LocalStorageActions.js @@ -8,6 +8,7 @@ import * as DISCOVERY from 'actions/constants/discovery'; import * as STORAGE from 'actions/constants/localStorage'; import * as PENDING from 'actions/constants/pendingTx'; import { httpRequest } from 'utils/networkUtils'; +import * as buildUtils from 'utils/build'; import type { ThunkAction, AsyncAction, /* GetState, */ Dispatch, @@ -96,6 +97,12 @@ export function loadTokensFromJSON(): AsyncAction { try { const config: Config = await httpRequest(AppConfigJSON, 'json'); + + if (!buildUtils.isDev()) { + const index = config.coins.findIndex(c => c.network === 'trop'); + delete config.coins[index]; + } + const ERC20Abi = await httpRequest(Erc20AbiJSON, 'json'); window.addEventListener('storage', (event) => { diff --git a/src/actions/TrezorConnectActions.js b/src/actions/TrezorConnectActions.js index 85d03cf3..b7320a2e 100644 --- a/src/actions/TrezorConnectActions.js +++ b/src/actions/TrezorConnectActions.js @@ -8,6 +8,7 @@ import * as NOTIFICATION from 'actions/constants/notification'; import { getDuplicateInstanceNumber } from 'reducers/utils'; import * as RouterActions from 'actions/RouterActions'; import * as deviceUtils from 'utils/device'; +import * as buildUtils from 'utils/build'; import type { DeviceMessage, @@ -123,9 +124,9 @@ export const init = (): AsyncAction => async (dispatch: Dispatch, getState: GetS }); }); - window.__TREZOR_CONNECT_SRC = typeof LOCAL === 'string' ? LOCAL : 'https://sisyfos.trezor.io/connect/'; // eslint-disable-line no-underscore-dangle - // window.__TREZOR_CONNECT_SRC = typeof LOCAL === 'string' ? LOCAL : 'https://connect.trezor.io/5/'; // eslint-disable-line no-underscore-dangle - if (process.env.BUILD === 'development' || process.env.NODE_ENV === 'development') { + if (buildUtils.isDev()) { + window.__TREZOR_CONNECT_SRC = typeof LOCAL === 'string' ? LOCAL : 'https://sisyfos.trezor.io/connect/'; // eslint-disable-line no-underscore-dangle + // window.__TREZOR_CONNECT_SRC = typeof LOCAL === 'string' ? LOCAL : 'https://connect.trezor.io/5/'; // eslint-disable-line no-underscore-dangle window.TrezorConnect = TrezorConnect; } diff --git a/src/store.js b/src/store.js index 39600b1a..971aa367 100644 --- a/src/store.js +++ b/src/store.js @@ -10,6 +10,7 @@ import services from 'services'; import Raven from 'raven-js'; import RavenMiddleware from 'redux-raven-middleware'; +import * as buildUtils from 'utils/build'; import type { Action, GetState } from 'flowtype'; @@ -23,8 +24,8 @@ const middlewares = [ routerMiddleware(history), ]; -// sentry io middleware only in dev build -if (process.env.BUILD === 'development') { +// sentry io middleware only in dev and beta build +if (buildUtils.isDev() || buildUtils.isBeta()) { const RAVEN_KEY = 'https://34b8c09deb6c4cd2a4dc3f0029cd02d8@sentry.io/1279550'; const ravenMiddleware = RavenMiddleware(RAVEN_KEY); Raven.config(RAVEN_KEY).install(); @@ -32,7 +33,7 @@ if (process.env.BUILD === 'development') { } let composedEnhancers: any; -if (process.env.NODE_ENV === 'development') { +if (buildUtils.isDev()) { const excludeLogger = (getState: GetState, action: Action): boolean => { //'@@router/LOCATION_CHANGE' const excluded: Array = ['LOG_TO_EXCLUDE', 'log__add', undefined]; diff --git a/src/utils/build.js b/src/utils/build.js new file mode 100644 index 00000000..c5007fe3 --- /dev/null +++ b/src/utils/build.js @@ -0,0 +1,7 @@ +/* @flow */ + +// process.env.BUILD is set by package.json +// process.env.NODE_ENV is set by webpack.mode + +export const isDev = (): boolean => process.env.BUILD === 'development' || process.env.NODE_ENV === 'development'; +export const isBeta = (): boolean => process.env.BUILD === 'beta'; \ No newline at end of file