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" "react"
], ],
"plugins": [ "plugins": [
"react-hot-loader/babel",
"transform-class-properties", "transform-class-properties",
"transform-object-rest-spread", "transform-object-rest-spread",
"transform-flow-strip-types", "transform-flow-strip-types",

View File

@ -28,6 +28,7 @@
"babel-core": "^6.26.3", "babel-core": "^6.26.3",
"color-hash": "^1.0.3", "color-hash": "^1.0.3",
"copy-webpack-plugin": "^4.5.2", "copy-webpack-plugin": "^4.5.2",
"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",
"ethereumjs-util": "^5.1.4", "ethereumjs-util": "^5.1.4",
@ -41,7 +42,7 @@
"react": "^16.2.0", "react": "^16.2.0",
"react-css-transition": "^0.7.4", "react-css-transition": "^0.7.4",
"react-dom": "^16.2.0", "react-dom": "^16.2.0",
"react-hot-loader": "4.2.0", "react-hot-loader": "^4.3.4",
"react-qr-svg": "^2.1.0", "react-qr-svg": "^2.1.0",
"react-redux": "^5.0.7", "react-redux": "^5.0.7",
"react-router-dom": "^4.2.2", "react-router-dom": "^4.2.2",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2794,7 +2794,7 @@ data-urls@^1.0.0:
whatwg-mimetype "^2.0.0" whatwg-mimetype "^2.0.0"
whatwg-url "^6.4.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" version "1.29.0"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" 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" object-assign "^4.1.1"
prop-types "^15.6.0" prop-types "^15.6.0"
react-hot-loader@4.2.0: react-hot-loader@^4.3.4:
version "4.2.0" version "4.3.4"
resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.2.0.tgz#4a2ec79114f872e28ea786e04889d643ad3dfb7c" resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.3.4.tgz#4f9bdd55bb20d77a6ae8931fa1c187e5f0ce6279"
dependencies: dependencies:
fast-levenshtein "^2.0.6" fast-levenshtein "^2.0.6"
global "^4.3.0" global "^4.3.0"