mirror of
https://github.com/trezor/trezor-wallet
synced 2025-05-13 12:28:50 +00:00
Added public folder, adjust webpack to new configuration
This commit is contained in:
parent
3f7cf6ca27
commit
bc2d03a7ae
16
package.json
16
package.json
@ -11,16 +11,18 @@
|
|||||||
},
|
},
|
||||||
"license": "LGPL-3.0+",
|
"license": "LGPL-3.0+",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "webpack-dev-server --config ./webpack/config.dev.babel.js --mode development",
|
"dev": "npx webpack-dev-server --config ./webpack/dev.babel.js",
|
||||||
"dev:local": "webpack-dev-server --config ./webpack/config.dev.local.babel.js --mode development",
|
"dev:local": "npx webpack-dev-server --config ./webpack/local.babel.js",
|
||||||
"build": "rm -rf build && webpack --config ./webpack/config.prod.babel.js --progress",
|
"build:clean": "rm -rf build",
|
||||||
|
"build:production": "npx webpack --config ./webpack/production.babel.js --progress --bail",
|
||||||
|
"build": "run-s build:*",
|
||||||
"flow": "flow check src",
|
"flow": "flow check src",
|
||||||
"lint": "run-s lint:*",
|
"lint": "run-s lint:*",
|
||||||
"lint:js": "eslint ./src ./webpack",
|
"lint:js": "npx eslint ./src ./webpack",
|
||||||
"lint:css": "stylelint './src/**/*.js'",
|
"lint:css": "npx stylelint './src/**/*.js'",
|
||||||
"test": "run-s test:*",
|
"test": "run-s test:*",
|
||||||
"test:unit": "jest",
|
"test:unit": "npx jest",
|
||||||
"test-unit:watch": "jest -o --watch"
|
"test-unit:watch": "npx jest -o --watch"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel": "^6.23.0",
|
"babel": "^6.23.0",
|
||||||
|
@ -14,8 +14,8 @@ import type {
|
|||||||
} from 'flowtype';
|
} from 'flowtype';
|
||||||
import type { Config, Coin, TokensCollection } from 'reducers/LocalStorageReducer';
|
import type { Config, Coin, TokensCollection } from 'reducers/LocalStorageReducer';
|
||||||
|
|
||||||
import AppConfigJSON from 'data/appConfig.json';
|
import Erc20AbiJSON from 'public/data/ERC20Abi.json';
|
||||||
import Erc20AbiJSON from 'data/ERC20Abi.json';
|
import AppConfigJSON from 'public/data/appConfig.json';
|
||||||
|
|
||||||
export type StorageAction = {
|
export type StorageAction = {
|
||||||
type: typeof STORAGE.READY,
|
type: typeof STORAGE.READY,
|
||||||
|
@ -31,7 +31,7 @@ const Footer = ({ toggle }) => (
|
|||||||
<Wrapper>
|
<Wrapper>
|
||||||
<Copy>© {getYear(new Date())}</Copy>
|
<Copy>© {getYear(new Date())}</Copy>
|
||||||
<StyledLink href="http://satoshilabs.com" target="_blank" rel="noreferrer noopener" isGreen>SatoshiLabs</StyledLink>
|
<StyledLink href="http://satoshilabs.com" target="_blank" rel="noreferrer noopener" isGreen>SatoshiLabs</StyledLink>
|
||||||
<StyledLink href="tos.pdf" target="_blank" rel="noreferrer noopener" isGreen>Terms</StyledLink>
|
<StyledLink href="/assets/tos.pdf" target="_blank" rel="noreferrer noopener" isGreen>Terms</StyledLink>
|
||||||
<StyledLink onClick={toggle} isGreen>Show Log</StyledLink>
|
<StyledLink onClick={toggle} isGreen>Show Log</StyledLink>
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
|
@ -6,6 +6,7 @@ export const ABSOLUTE_BASE: string = path.normalize(path.join(__dirname, '..'));
|
|||||||
|
|
||||||
const constants: Object = Object.freeze({
|
const constants: Object = Object.freeze({
|
||||||
BUILD: path.join(ABSOLUTE_BASE, 'build/'),
|
BUILD: path.join(ABSOLUTE_BASE, 'build/'),
|
||||||
|
PUBLIC: path.join(ABSOLUTE_BASE, 'public/'),
|
||||||
SRC: path.join(ABSOLUTE_BASE, 'src/'),
|
SRC: path.join(ABSOLUTE_BASE, 'src/'),
|
||||||
PORT: 8081,
|
PORT: 8081,
|
||||||
INDEX: path.join(ABSOLUTE_BASE, 'src/index.html'),
|
INDEX: path.join(ABSOLUTE_BASE, 'src/index.html'),
|
||||||
@ -24,5 +25,6 @@ export const BUILD: string = constants.BUILD;
|
|||||||
export const SRC: string = constants.SRC;
|
export const SRC: string = constants.SRC;
|
||||||
export const PORT: string = constants.PORT;
|
export const PORT: string = constants.PORT;
|
||||||
export const INDEX: string = constants.INDEX;
|
export const INDEX: string = constants.INDEX;
|
||||||
|
export const PUBLIC: string = constants.PUBLIC;
|
||||||
|
|
||||||
export default constants;
|
export default constants;
|
@ -1,7 +1,9 @@
|
|||||||
import webpack from 'webpack';
|
import webpack from 'webpack';
|
||||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
||||||
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||||
import { SRC, BUILD, PORT } from './constants';
|
import {
|
||||||
|
SRC, BUILD, PORT, PUBLIC,
|
||||||
|
} from './constants';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
watch: true,
|
watch: true,
|
||||||
@ -15,7 +17,10 @@ module.exports = {
|
|||||||
path: BUILD,
|
path: BUILD,
|
||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
contentBase: SRC,
|
contentBase: [
|
||||||
|
SRC,
|
||||||
|
PUBLIC,
|
||||||
|
],
|
||||||
hot: true,
|
hot: true,
|
||||||
https: false,
|
https: false,
|
||||||
port: PORT,
|
port: PORT,
|
||||||
@ -69,6 +74,9 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
public: PUBLIC,
|
||||||
|
},
|
||||||
modules: [SRC, 'node_modules'],
|
modules: [SRC, 'node_modules'],
|
||||||
},
|
},
|
||||||
performance: {
|
performance: {
|
@ -9,6 +9,7 @@ import {
|
|||||||
TREZOR_CONNECT, TREZOR_IFRAME, TREZOR_POPUP, TREZOR_WEBUSB,
|
TREZOR_CONNECT, TREZOR_IFRAME, TREZOR_POPUP, TREZOR_WEBUSB,
|
||||||
SRC,
|
SRC,
|
||||||
BUILD,
|
BUILD,
|
||||||
|
PUBLIC,
|
||||||
PORT,
|
PORT,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
|
||||||
@ -30,7 +31,10 @@ module.exports = {
|
|||||||
globalObject: 'this', // fix for HMR inside WebWorker from 'hd-wallet'
|
globalObject: 'this', // fix for HMR inside WebWorker from 'hd-wallet'
|
||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
contentBase: SRC,
|
contentBase: [
|
||||||
|
SRC,
|
||||||
|
PUBLIC,
|
||||||
|
],
|
||||||
hot: true,
|
hot: true,
|
||||||
https: false,
|
https: false,
|
||||||
port: PORT,
|
port: PORT,
|
||||||
@ -92,8 +96,12 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
modules: [SRC, 'node_modules', `${TREZOR_CONNECT_ROOT}/node_modules`],
|
modules: [
|
||||||
|
SRC,
|
||||||
|
'node_modules',
|
||||||
|
`${TREZOR_CONNECT_ROOT}/node_modules`],
|
||||||
alias: {
|
alias: {
|
||||||
|
public: PUBLIC,
|
||||||
'trezor-connect': `${TREZOR_CONNECT}`,
|
'trezor-connect': `${TREZOR_CONNECT}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
@ -3,7 +3,7 @@ import webpack from 'webpack';
|
|||||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
||||||
import CopyWebpackPlugin from 'copy-webpack-plugin';
|
import CopyWebpackPlugin from 'copy-webpack-plugin';
|
||||||
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||||
import { SRC, BUILD } from './constants';
|
import { SRC, BUILD, PUBLIC } from './constants';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
mode: 'production',
|
mode: 'production',
|
||||||
@ -73,6 +73,9 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
public: PUBLIC,
|
||||||
|
},
|
||||||
modules: [SRC, 'node_modules'],
|
modules: [SRC, 'node_modules'],
|
||||||
},
|
},
|
||||||
performance: {
|
performance: {
|
||||||
@ -82,22 +85,15 @@ module.exports = {
|
|||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: 'css/[name].[hash].css',
|
filename: 'css/[name].[hash].css',
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
chunks: ['index'],
|
chunks: ['index'],
|
||||||
template: `${SRC}index.html`,
|
template: `${SRC}index.html`,
|
||||||
filename: 'index.html',
|
filename: 'index.html',
|
||||||
inject: true,
|
inject: true,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new CopyWebpackPlugin([
|
new CopyWebpackPlugin([
|
||||||
//{from: `${SRC}/app/robots.txt`},
|
{ from: `${PUBLIC}`, to: './' },
|
||||||
{ from: `${SRC}images/favicon.ico`, to: `${BUILD}favicon.ico` },
|
|
||||||
{ from: `${SRC}images/favicon.png`, to: `${BUILD}favicon.png` },
|
|
||||||
{ from: `${SRC}data`, to: `${BUILD}data`, cache: false },
|
|
||||||
{ from: `${SRC}assets`, to: `${BUILD}assets`, cache: false },
|
|
||||||
]),
|
]),
|
||||||
|
|
||||||
new webpack.optimize.OccurrenceOrderPlugin(),
|
new webpack.optimize.OccurrenceOrderPlugin(),
|
||||||
new webpack.NoEmitOnErrorsPlugin(),
|
new webpack.NoEmitOnErrorsPlugin(),
|
||||||
new webpack.NamedModulesPlugin(),
|
new webpack.NamedModulesPlugin(),
|
Loading…
Reference in New Issue
Block a user