1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-12-02 21:28:12 +00:00

Merge pull request #177 from trezor/fix/build-beta

beta build
This commit is contained in:
Vladimir Volek 2018-10-11 21:13:51 +02:00 committed by GitHub
commit 5d9db80d51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 8 deletions

3
.gitignore vendored
View File

@ -1,5 +1,6 @@
build
build-devel
build-beta
build-dev
# Dependency directory
node_modules

View File

@ -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:*",

View File

@ -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) => {

View File

@ -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;
}

View File

@ -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<?string> = ['LOG_TO_EXCLUDE', 'log__add', undefined];

7
src/utils/build.js Normal file
View 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';