mirror of
https://github.com/trezor/trezor-wallet
synced 2024-12-03 13:48:15 +00:00
commit
5d9db80d51
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
build
|
build
|
||||||
build-devel
|
build-beta
|
||||||
|
build-dev
|
||||||
|
|
||||||
# Dependency directory
|
# Dependency directory
|
||||||
node_modules
|
node_modules
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
"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:prod": "rimraf build && npx webpack --config webpack/production.babel.js --progress --bail",
|
"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:*",
|
"build": "run-s build:*",
|
||||||
"flow": "flow check src",
|
"flow": "flow check src",
|
||||||
"lint": "run-s lint:*",
|
"lint": "run-s lint:*",
|
||||||
|
@ -8,6 +8,7 @@ import * as DISCOVERY from 'actions/constants/discovery';
|
|||||||
import * as STORAGE from 'actions/constants/localStorage';
|
import * as STORAGE from 'actions/constants/localStorage';
|
||||||
import * as PENDING from 'actions/constants/pendingTx';
|
import * as PENDING from 'actions/constants/pendingTx';
|
||||||
import { httpRequest } from 'utils/networkUtils';
|
import { httpRequest } from 'utils/networkUtils';
|
||||||
|
import * as buildUtils from 'utils/build';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
ThunkAction, AsyncAction, /* GetState, */ Dispatch,
|
ThunkAction, AsyncAction, /* GetState, */ Dispatch,
|
||||||
@ -96,6 +97,12 @@ export function loadTokensFromJSON(): AsyncAction {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const config: Config = await httpRequest(AppConfigJSON, 'json');
|
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');
|
const ERC20Abi = await httpRequest(Erc20AbiJSON, 'json');
|
||||||
|
|
||||||
window.addEventListener('storage', (event) => {
|
window.addEventListener('storage', (event) => {
|
||||||
|
@ -8,6 +8,7 @@ import * as NOTIFICATION from 'actions/constants/notification';
|
|||||||
import { getDuplicateInstanceNumber } from 'reducers/utils';
|
import { getDuplicateInstanceNumber } from 'reducers/utils';
|
||||||
import * as RouterActions from 'actions/RouterActions';
|
import * as RouterActions from 'actions/RouterActions';
|
||||||
import * as deviceUtils from 'utils/device';
|
import * as deviceUtils from 'utils/device';
|
||||||
|
import * as buildUtils from 'utils/build';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
DeviceMessage,
|
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
|
if (buildUtils.isDev()) {
|
||||||
// window.__TREZOR_CONNECT_SRC = typeof LOCAL === 'string' ? LOCAL : 'https://connect.trezor.io/5/'; // eslint-disable-line no-underscore-dangle
|
window.__TREZOR_CONNECT_SRC = typeof LOCAL === 'string' ? LOCAL : 'https://sisyfos.trezor.io/connect/'; // eslint-disable-line no-underscore-dangle
|
||||||
if (process.env.BUILD === 'development' || process.env.NODE_ENV === 'development') {
|
// window.__TREZOR_CONNECT_SRC = typeof LOCAL === 'string' ? LOCAL : 'https://connect.trezor.io/5/'; // eslint-disable-line no-underscore-dangle
|
||||||
window.TrezorConnect = TrezorConnect;
|
window.TrezorConnect = TrezorConnect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import services from 'services';
|
|||||||
|
|
||||||
import Raven from 'raven-js';
|
import Raven from 'raven-js';
|
||||||
import RavenMiddleware from 'redux-raven-middleware';
|
import RavenMiddleware from 'redux-raven-middleware';
|
||||||
|
import * as buildUtils from 'utils/build';
|
||||||
|
|
||||||
import type { Action, GetState } from 'flowtype';
|
import type { Action, GetState } from 'flowtype';
|
||||||
|
|
||||||
@ -23,8 +24,8 @@ const middlewares = [
|
|||||||
routerMiddleware(history),
|
routerMiddleware(history),
|
||||||
];
|
];
|
||||||
|
|
||||||
// sentry io middleware only in dev build
|
// sentry io middleware only in dev and beta build
|
||||||
if (process.env.BUILD === 'development') {
|
if (buildUtils.isDev() || buildUtils.isBeta()) {
|
||||||
const RAVEN_KEY = 'https://34b8c09deb6c4cd2a4dc3f0029cd02d8@sentry.io/1279550';
|
const RAVEN_KEY = 'https://34b8c09deb6c4cd2a4dc3f0029cd02d8@sentry.io/1279550';
|
||||||
const ravenMiddleware = RavenMiddleware(RAVEN_KEY);
|
const ravenMiddleware = RavenMiddleware(RAVEN_KEY);
|
||||||
Raven.config(RAVEN_KEY).install();
|
Raven.config(RAVEN_KEY).install();
|
||||||
@ -32,7 +33,7 @@ if (process.env.BUILD === 'development') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let composedEnhancers: any;
|
let composedEnhancers: any;
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (buildUtils.isDev()) {
|
||||||
const excludeLogger = (getState: GetState, action: Action): boolean => {
|
const excludeLogger = (getState: GetState, action: Action): boolean => {
|
||||||
//'@@router/LOCATION_CHANGE'
|
//'@@router/LOCATION_CHANGE'
|
||||||
const excluded: Array<?string> = ['LOG_TO_EXCLUDE', 'log__add', undefined];
|
const excluded: Array<?string> = ['LOG_TO_EXCLUDE', 'log__add', undefined];
|
||||||
|
7
src/utils/build.js
Normal file
7
src/utils/build.js
Normal file
@ -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';
|
Loading…
Reference in New Issue
Block a user