1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 01:08:27 +00:00

Fixed hot loader and year in footer

This commit is contained in:
Vladimir Volek 2018-08-10 17:18:22 +02:00
parent 1ab5e9c8ab
commit eac49bd78d
9 changed files with 42 additions and 51 deletions

View File

@ -7,6 +7,7 @@
"react"
],
"plugins": [
"react-hot-loader/babel",
"transform-class-properties",
"transform-object-rest-spread",
"transform-flow-strip-types",

View File

@ -28,6 +28,7 @@
"babel-core": "^6.26.3",
"color-hash": "^1.0.3",
"copy-webpack-plugin": "^4.5.2",
"date-fns": "^1.29.0",
"ethereumjs-tx": "^1.3.3",
"ethereumjs-units": "^0.2.0",
"ethereumjs-util": "^5.1.4",
@ -41,7 +42,7 @@
"react": "^16.2.0",
"react-css-transition": "^0.7.4",
"react-dom": "^16.2.0",
"react-hot-loader": "4.2.0",
"react-hot-loader": "^4.3.4",
"react-qr-svg": "^2.1.0",
"react-redux": "^5.0.7",
"react-router-dom": "^4.2.2",

View File

@ -1,6 +1,7 @@
import styled from 'styled-components';
import PropTypes from 'prop-types';
import React from 'react';
import { getYear } from 'date-fns';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
@ -27,7 +28,7 @@ const Copy = styled.div`
const Footer = ({ toggle }) => (
<Wrapper>
<Copy>© 2018</Copy>
<Copy>© {getYear(new Date())}</Copy>
<A href="http://satoshilabs.com" target="_blank" rel="noreferrer noopener" className="satoshi green">SatoshiLabs</A>
<A href="tos.pdf" target="_blank" rel="noreferrer noopener" className="green">Terms</A>
<A onClick={toggle} className="green">Show Log</A>

View File

@ -2,22 +2,17 @@
import React from 'react';
import { render } from 'react-dom';
import store from './store';
import router from './router';
import App from './router';
import { onBeforeUnload } from './actions/WalletActions';
import styles from '~/styles/index.less';
const root: ?HTMLElement = document.getElementById('root');
if (root) {
render(router, root);
render(<App />, root);
}
window.onbeforeunload = () => {
store.dispatch(onBeforeUnload());
};
if (typeof module !== undefined && module.hasOwnProperty('hot')) {
// $FlowIssue
module.hot.accept();
}
// Application life cycle starts in ./services/WalletService.js

View File

@ -1,7 +1,5 @@
/* @flow */
import React from 'react';
import { hot } from 'react-hot-loader';
import { Route, Switch } from 'react-router-dom';
import { Provider } from 'react-redux';
import { ConnectedRouter } from 'react-router-redux';
@ -22,7 +20,7 @@ import SignVerifyContainer from '../components/wallet/account/sign/SignVerify';
import DeviceSettingsContainer from '../components/wallet/pages/DeviceSettings';
import WalletSettingsContainer from '../components/wallet/pages/WalletSettings';
export default (
const App = () => (
<Provider store={store}>
<ConnectedRouter history={history}>
<Switch>
@ -49,4 +47,6 @@ export default (
</Switch>
</ConnectedRouter>
</Provider>
);
);
export default hot(module)(App);

View File

@ -4,7 +4,6 @@
import { DEVICE } from 'trezor-connect';
import { LOCATION_CHANGE } from 'react-router-redux';
import * as WALLET from '../actions/constants/wallet';
import * as SEND from '../actions/constants/wallet';
import * as WalletActions from '../actions/WalletActions';
import * as LocalStorageActions from '../actions/LocalStorageActions';
@ -15,11 +14,7 @@ import type {
Middleware,
MiddlewareAPI,
MiddlewareDispatch,
State,
Dispatch,
Action,
GetState,
TrezorDevice,
} from '~/flowtype';
/**

View File

@ -9,7 +9,7 @@ module.exports = {
mode: 'development',
devtool: 'inline-source-map',
entry: {
index: ['react-hot-loader/patch', `${SRC}js/index.js`],
index: [`${SRC}js/index.js`],
},
output: {
filename: '[name].[hash].js',

View File

@ -1,3 +1,7 @@
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import {
TREZOR_CONNECT_ROOT,
TREZOR_CONNECT_HTML,
@ -5,26 +9,20 @@ import {
TREZOR_CONNECT, TREZOR_IFRAME, TREZOR_POPUP, TREZOR_WEBUSB,
SRC,
BUILD,
PORT
PORT,
} from './constants';
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
module.exports = {
watch: true,
mode: 'development',
devtool: 'inline-source-map',
entry: {
'index': ['react-hot-loader/patch', `${SRC}js/index.js`],
index: [`${SRC}js/index.js`],
'trezor-connect-npm': `${TREZOR_CONNECT}.js`,
// 'extension-permissions': `${TREZOR_CONNECT_ROOT}src/js/extensionPermissions.js`,
'iframe': TREZOR_IFRAME,
'popup': TREZOR_POPUP,
'webusb': TREZOR_WEBUSB,
iframe: TREZOR_IFRAME,
popup: TREZOR_POPUP,
webusb: TREZOR_WEBUSB,
},
output: {
filename: '[name].[hash].js',
@ -44,18 +42,18 @@ module.exports = {
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: ['babel-loader']
use: ['babel-loader'],
},
{
test: /\.less$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: { publicPath: '../' }
options: { publicPath: '../' },
},
'css-loader',
'less-loader',
]
],
},
{
test: /\.(png|gif|jpg)$/,
@ -63,7 +61,7 @@ module.exports = {
query: {
outputPath: './images',
name: '[name].[ext]',
}
},
},
{
test: /\.(ttf|eot|svg|woff|woff2)$/,
@ -96,11 +94,11 @@ module.exports = {
resolve: {
modules: [SRC, 'node_modules', `${TREZOR_CONNECT_ROOT}/node_modules`],
alias: {
'trezor-connect': `${TREZOR_CONNECT}`
}
'trezor-connect': `${TREZOR_CONNECT}`,
},
},
performance: {
hints: false
hints: false,
},
plugins: [
new MiniCssExtractPlugin({
@ -112,26 +110,26 @@ module.exports = {
chunks: ['index'],
template: `${SRC}index.html`,
filename: 'index.html',
inject: true
inject: true,
}),
new HtmlWebpackPlugin({
chunks: ['iframe'],
filename: `iframe.html`,
filename: 'iframe.html',
template: `${TREZOR_CONNECT_HTML}iframe.html`,
inject: false
inject: false,
}),
new HtmlWebpackPlugin({
chunks: ['popup'],
filename: 'popup.html',
template: `${TREZOR_CONNECT_HTML}popup.html`,
inject: false
inject: false,
}),
new HtmlWebpackPlugin({
chunks: ['webusb'],
filename: `webusb.html`,
filename: 'webusb.html',
template: `${TREZOR_CONNECT_HTML}webusb.html`,
inject: true
inject: true,
}),
// new HtmlWebpackPlugin({
// chunks: ['extension-permissions'],
@ -158,7 +156,7 @@ module.exports = {
],
// ignoring "fs" import in fastxpub
node: {
fs: "empty",
path: "empty",
fs: 'empty',
path: 'empty',
},
}
};

View File

@ -2794,7 +2794,7 @@ data-urls@^1.0.0:
whatwg-mimetype "^2.0.0"
whatwg-url "^6.4.0"
date-fns@^1.27.2:
date-fns@^1.27.2, date-fns@^1.29.0:
version "1.29.0"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6"
@ -7785,9 +7785,9 @@ react-css-transition@^0.7.4:
object-assign "^4.1.1"
prop-types "^15.6.0"
react-hot-loader@4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.2.0.tgz#4a2ec79114f872e28ea786e04889d643ad3dfb7c"
react-hot-loader@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.3.4.tgz#4f9bdd55bb20d77a6ae8931fa1c187e5f0ce6279"
dependencies:
fast-levenshtein "^2.0.6"
global "^4.3.0"