mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-24 01:08:27 +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+",
|
||||
"scripts": {
|
||||
"dev": "webpack-dev-server --config ./webpack/config.dev.babel.js --mode development",
|
||||
"dev:local": "webpack-dev-server --config ./webpack/config.dev.local.babel.js --mode development",
|
||||
"build": "rm -rf build && webpack --config ./webpack/config.prod.babel.js --progress",
|
||||
"dev": "npx webpack-dev-server --config ./webpack/dev.babel.js",
|
||||
"dev:local": "npx webpack-dev-server --config ./webpack/local.babel.js",
|
||||
"build:clean": "rm -rf build",
|
||||
"build:production": "npx webpack --config ./webpack/production.babel.js --progress --bail",
|
||||
"build": "run-s build:*",
|
||||
"flow": "flow check src",
|
||||
"lint": "run-s lint:*",
|
||||
"lint:js": "eslint ./src ./webpack",
|
||||
"lint:css": "stylelint './src/**/*.js'",
|
||||
"lint:js": "npx eslint ./src ./webpack",
|
||||
"lint:css": "npx stylelint './src/**/*.js'",
|
||||
"test": "run-s test:*",
|
||||
"test:unit": "jest",
|
||||
"test-unit:watch": "jest -o --watch"
|
||||
"test:unit": "npx jest",
|
||||
"test-unit:watch": "npx jest -o --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"babel": "^6.23.0",
|
||||
|
@ -14,8 +14,8 @@ import type {
|
||||
} from 'flowtype';
|
||||
import type { Config, Coin, TokensCollection } from 'reducers/LocalStorageReducer';
|
||||
|
||||
import AppConfigJSON from 'data/appConfig.json';
|
||||
import Erc20AbiJSON from 'data/ERC20Abi.json';
|
||||
import Erc20AbiJSON from 'public/data/ERC20Abi.json';
|
||||
import AppConfigJSON from 'public/data/appConfig.json';
|
||||
|
||||
export type StorageAction = {
|
||||
type: typeof STORAGE.READY,
|
||||
|
@ -31,7 +31,7 @@ const Footer = ({ toggle }) => (
|
||||
<Wrapper>
|
||||
<Copy>© {getYear(new Date())}</Copy>
|
||||
<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>
|
||||
</Wrapper>
|
||||
);
|
||||
|
@ -6,6 +6,7 @@ export const ABSOLUTE_BASE: string = path.normalize(path.join(__dirname, '..'));
|
||||
|
||||
const constants: Object = Object.freeze({
|
||||
BUILD: path.join(ABSOLUTE_BASE, 'build/'),
|
||||
PUBLIC: path.join(ABSOLUTE_BASE, 'public/'),
|
||||
SRC: path.join(ABSOLUTE_BASE, 'src/'),
|
||||
PORT: 8081,
|
||||
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 PORT: string = constants.PORT;
|
||||
export const INDEX: string = constants.INDEX;
|
||||
export const PUBLIC: string = constants.PUBLIC;
|
||||
|
||||
export default constants;
|
@ -1,7 +1,9 @@
|
||||
import webpack from 'webpack';
|
||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
||||
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||
import { SRC, BUILD, PORT } from './constants';
|
||||
import {
|
||||
SRC, BUILD, PORT, PUBLIC,
|
||||
} from './constants';
|
||||
|
||||
module.exports = {
|
||||
watch: true,
|
||||
@ -15,7 +17,10 @@ module.exports = {
|
||||
path: BUILD,
|
||||
},
|
||||
devServer: {
|
||||
contentBase: SRC,
|
||||
contentBase: [
|
||||
SRC,
|
||||
PUBLIC,
|
||||
],
|
||||
hot: true,
|
||||
https: false,
|
||||
port: PORT,
|
||||
@ -69,6 +74,9 @@ module.exports = {
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
public: PUBLIC,
|
||||
},
|
||||
modules: [SRC, 'node_modules'],
|
||||
},
|
||||
performance: {
|
@ -9,6 +9,7 @@ import {
|
||||
TREZOR_CONNECT, TREZOR_IFRAME, TREZOR_POPUP, TREZOR_WEBUSB,
|
||||
SRC,
|
||||
BUILD,
|
||||
PUBLIC,
|
||||
PORT,
|
||||
} from './constants';
|
||||
|
||||
@ -30,7 +31,10 @@ module.exports = {
|
||||
globalObject: 'this', // fix for HMR inside WebWorker from 'hd-wallet'
|
||||
},
|
||||
devServer: {
|
||||
contentBase: SRC,
|
||||
contentBase: [
|
||||
SRC,
|
||||
PUBLIC,
|
||||
],
|
||||
hot: true,
|
||||
https: false,
|
||||
port: PORT,
|
||||
@ -92,8 +96,12 @@ module.exports = {
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
modules: [SRC, 'node_modules', `${TREZOR_CONNECT_ROOT}/node_modules`],
|
||||
modules: [
|
||||
SRC,
|
||||
'node_modules',
|
||||
`${TREZOR_CONNECT_ROOT}/node_modules`],
|
||||
alias: {
|
||||
public: PUBLIC,
|
||||
'trezor-connect': `${TREZOR_CONNECT}`,
|
||||
},
|
||||
},
|
@ -3,7 +3,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 { SRC, BUILD } from './constants';
|
||||
import { SRC, BUILD, PUBLIC } from './constants';
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
@ -73,6 +73,9 @@ module.exports = {
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
public: PUBLIC,
|
||||
},
|
||||
modules: [SRC, 'node_modules'],
|
||||
},
|
||||
performance: {
|
||||
@ -82,22 +85,15 @@ module.exports = {
|
||||
new MiniCssExtractPlugin({
|
||||
filename: 'css/[name].[hash].css',
|
||||
}),
|
||||
|
||||
new HtmlWebpackPlugin({
|
||||
chunks: ['index'],
|
||||
template: `${SRC}index.html`,
|
||||
filename: 'index.html',
|
||||
inject: true,
|
||||
}),
|
||||
|
||||
new CopyWebpackPlugin([
|
||||
//{from: `${SRC}/app/robots.txt`},
|
||||
{ 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 },
|
||||
{ from: `${PUBLIC}`, to: './' },
|
||||
]),
|
||||
|
||||
new webpack.optimize.OccurrenceOrderPlugin(),
|
||||
new webpack.NoEmitOnErrorsPlugin(),
|
||||
new webpack.NamedModulesPlugin(),
|
Loading…
Reference in New Issue
Block a user