mirror of
https://github.com/trezor/trezor-wallet
synced 2025-07-02 04:42:34 +00:00
Lint rest
This commit is contained in:
parent
82f8d8d36b
commit
a29901a11d
@ -1,4 +1,4 @@
|
|||||||
module.exports = (api) => {
|
module.exports = api => {
|
||||||
// api.cache.forever();
|
// api.cache.forever();
|
||||||
|
|
||||||
const presets = [
|
const presets = [
|
||||||
@ -27,13 +27,9 @@ module.exports = (api) => {
|
|||||||
[
|
[
|
||||||
'module-resolver',
|
'module-resolver',
|
||||||
{
|
{
|
||||||
root: [
|
root: ['./src'],
|
||||||
'./src',
|
|
||||||
],
|
|
||||||
alias: {
|
alias: {
|
||||||
public: [
|
public: ['./public'],
|
||||||
'./public',
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -45,19 +41,17 @@ module.exports = (api) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (api.env('translations')) {
|
if (api.env('translations')) {
|
||||||
plugins.push(
|
plugins.push([
|
||||||
[
|
'react-intl',
|
||||||
'react-intl',
|
{
|
||||||
{
|
messagesDir: './translations/extractedMessages/',
|
||||||
messagesDir: './translations/extractedMessages/',
|
extractSourceLocation: true,
|
||||||
extractSourceLocation: true,
|
},
|
||||||
},
|
]);
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
presets,
|
presets,
|
||||||
plugins,
|
plugins,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -11,10 +11,7 @@ module.exports = {
|
|||||||
'utils/promiseUtils.js',
|
'utils/promiseUtils.js',
|
||||||
'utils/networkUtils.js',
|
'utils/networkUtils.js',
|
||||||
],
|
],
|
||||||
collectCoverageFrom: [
|
collectCoverageFrom: ['utils/**.js', 'reducers/utils/**.js'],
|
||||||
'utils/**.js',
|
|
||||||
'reducers/utils/**.js',
|
|
||||||
],
|
|
||||||
coverageThreshold: {
|
coverageThreshold: {
|
||||||
global: {
|
global: {
|
||||||
branches: 100,
|
branches: 100,
|
||||||
@ -23,9 +20,7 @@ module.exports = {
|
|||||||
statements: 100,
|
statements: 100,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setupFiles: [
|
setupFiles: ['./support/setupJest.js'],
|
||||||
'./support/setupJest.js',
|
|
||||||
],
|
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.jsx?$': 'babel-jest',
|
'^.+\\.jsx?$': 'babel-jest',
|
||||||
},
|
},
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
"lint": "run-s lint:*",
|
"lint": "run-s lint:*",
|
||||||
"lint:js": "npx eslint ./src ./webpack",
|
"lint:js": "npx eslint ./src ./webpack",
|
||||||
"lint:css": "npx stylelint './src/**/*.js'",
|
"lint:css": "npx stylelint './src/**/*.js'",
|
||||||
"lint:prettier": "prettier --write ./src/**/*.js",
|
"lint:prettier": "pretty-quick",
|
||||||
"prettier:check": "eslint --print-config ./src | eslint-config-prettier-check",
|
"prettier:check": "eslint --print-config ./src | eslint-config-prettier-check",
|
||||||
"test": "run-s test:*",
|
"test": "run-s test:*",
|
||||||
"test:unit": "npx jest",
|
"test:unit": "npx jest",
|
||||||
@ -126,6 +126,7 @@
|
|||||||
"jest": "^24.1.0",
|
"jest": "^24.1.0",
|
||||||
"prettier": "^1.16.4",
|
"prettier": "^1.16.4",
|
||||||
"prettier-eslint": "^8.8.2",
|
"prettier-eslint": "^8.8.2",
|
||||||
|
"pretty-quick": "^1.10.0",
|
||||||
"prettylint": "^1.0.0",
|
"prettylint": "^1.0.0",
|
||||||
"stylelint": "^9.10.1",
|
"stylelint": "^9.10.1",
|
||||||
"stylelint-config-standard": "^18.2.0",
|
"stylelint-config-standard": "^18.2.0",
|
||||||
|
@ -25,7 +25,8 @@ export type DiscoveryStartAction =
|
|||||||
| RippleDiscoveryActions.DiscoveryStartAction;
|
| RippleDiscoveryActions.DiscoveryStartAction;
|
||||||
|
|
||||||
export type DiscoveryWaitingAction = {
|
export type DiscoveryWaitingAction = {
|
||||||
type: | typeof DISCOVERY.WAITING_FOR_DEVICE
|
type:
|
||||||
|
| typeof DISCOVERY.WAITING_FOR_DEVICE
|
||||||
| typeof DISCOVERY.WAITING_FOR_BLOCKCHAIN
|
| typeof DISCOVERY.WAITING_FOR_BLOCKCHAIN
|
||||||
| typeof DISCOVERY.FIRMWARE_NOT_SUPPORTED
|
| typeof DISCOVERY.FIRMWARE_NOT_SUPPORTED
|
||||||
| typeof DISCOVERY.FIRMWARE_OUTDATED,
|
| typeof DISCOVERY.FIRMWARE_OUTDATED,
|
||||||
|
@ -78,4 +78,4 @@ export default [
|
|||||||
blockHeight: 0,
|
blockHeight: 0,
|
||||||
blockHash: undefined,
|
blockHash: undefined,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -2,134 +2,99 @@ import * as utils from '../index';
|
|||||||
|
|
||||||
describe('reducers utils', () => {
|
describe('reducers utils', () => {
|
||||||
it('observer changes should BE THE SAME - return false', () => {
|
it('observer changes should BE THE SAME - return false', () => {
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges({}, {})).toBe(false);
|
||||||
{},
|
|
||||||
{},
|
|
||||||
)).toBe(false);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges([], [])).toBe(false);
|
||||||
[],
|
|
||||||
[],
|
|
||||||
)).toBe(false);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges([1, 1, 1], [1, 1, 1])).toBe(false);
|
||||||
[1, 1, 1],
|
|
||||||
[1, 1, 1],
|
|
||||||
)).toBe(false);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges('a', 'a')).toBe(false);
|
||||||
'a',
|
|
||||||
'a',
|
|
||||||
)).toBe(false);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges({ one: 1 }, { one: 1 })).toBe(false);
|
||||||
{ one: 1 },
|
|
||||||
{ one: 1 },
|
|
||||||
)).toBe(false);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges({ one: { two: 1 } }, { one: { two: 1 } })).toBe(false);
|
||||||
{ one: { two: 1 } },
|
|
||||||
{ one: { two: 1 } },
|
|
||||||
)).toBe(false);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges({ one: { two: [1, 2, 3] } }, { one: { two: [1, 2, 3] } })).toBe(
|
||||||
{ one: { two: [1, 2, 3] } },
|
false
|
||||||
{ one: { two: [1, 2, 3] } },
|
);
|
||||||
)).toBe(false);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(
|
||||||
{ one: { two: [1, { three: 1 }, 3] } },
|
utils.observeChanges(
|
||||||
{ one: { two: [1, { three: 1 }, 3] } },
|
{ one: { two: [1, { three: 1 }, 3] } },
|
||||||
)).toBe(false);
|
{ one: { two: [1, { three: 1 }, 3] } }
|
||||||
|
)
|
||||||
|
).toBe(false);
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(
|
||||||
{ one: { two: [1, { three: 1 }, { four: 3, five: { six: 3 } }] } },
|
utils.observeChanges(
|
||||||
{ one: { two: [1, { three: 1 }, { four: 3, five: { six: 3 } }] } },
|
{ one: { two: [1, { three: 1 }, { four: 3, five: { six: 3 } }] } },
|
||||||
)).toBe(false);
|
{ one: { two: [1, { three: 1 }, { four: 3, five: { six: 3 } }] } }
|
||||||
|
)
|
||||||
|
).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('observer should NOT be the same - return true', () => {
|
it('observer should NOT be the same - return true', () => {
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges(null, {})).toBe(true);
|
||||||
null,
|
|
||||||
{},
|
|
||||||
)).toBe(true);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges({ one: 1 }, {})).toBe(true);
|
||||||
{ one: 1 },
|
|
||||||
{},
|
|
||||||
)).toBe(true);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges({ one: 1, three: 3 }, { one: 1, two: 2 })).toBe(true);
|
||||||
{ one: 1, three: 3 }, { one: 1, two: 2 },
|
|
||||||
)).toBe(true);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges([{}, {}], [])).toBe(true);
|
||||||
[{}, {}],
|
|
||||||
[],
|
|
||||||
)).toBe(true);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges([1, 1, 1], [1, 1])).toBe(true);
|
||||||
[1, 1, 1],
|
|
||||||
[1, 1],
|
|
||||||
)).toBe(true);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges('a', 'b')).toBe(true);
|
||||||
'a',
|
|
||||||
'b',
|
|
||||||
)).toBe(true);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges(['a'], ['b'])).toBe(true);
|
||||||
['a'],
|
|
||||||
['b'],
|
|
||||||
)).toBe(true);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges(1, '1')).toBe(true);
|
||||||
1,
|
|
||||||
'1',
|
|
||||||
)).toBe(true);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges({ one: 1 }, { one: 2 })).toBe(true);
|
||||||
{ one: 1 },
|
|
||||||
{ one: 2 },
|
|
||||||
)).toBe(true);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges({ one: { two: 1 } }, { one: { two: 2 } })).toBe(true);
|
||||||
{ one: { two: 1 } },
|
|
||||||
{ one: { two: 2 } },
|
|
||||||
)).toBe(true);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(utils.observeChanges({ one: { two: [1, 2, 3] } }, { one: { two: [1, 1, 3] } })).toBe(
|
||||||
{ one: { two: [1, 2, 3] } },
|
true
|
||||||
{ one: { two: [1, 1, 3] } },
|
);
|
||||||
)).toBe(true);
|
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(
|
||||||
{ one: { two: [1, { three: 1 }, 3] } },
|
utils.observeChanges(
|
||||||
{ one: { two: [1, { three: 2 }, 3] } },
|
{ one: { two: [1, { three: 1 }, 3] } },
|
||||||
)).toBe(true);
|
{ one: { two: [1, { three: 2 }, 3] } }
|
||||||
|
)
|
||||||
|
).toBe(true);
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(
|
||||||
{ one: { two: [1, { three: 1 }, { four: 3, five: { six: 3 } }] } },
|
utils.observeChanges(
|
||||||
{ one: { two: [1, { three: 1 }, { four: 3, five: { six: 1 } }] } },
|
{ one: { two: [1, { three: 1 }, { four: 3, five: { six: 3 } }] } },
|
||||||
)).toBe(true);
|
{ one: { two: [1, { three: 1 }, { four: 3, five: { six: 1 } }] } }
|
||||||
|
)
|
||||||
|
).toBe(true);
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(
|
||||||
{ one: { two: [1, { three: 1 }, { four: 3, five: { sixxx: 3 } }] } },
|
utils.observeChanges(
|
||||||
{ one: { two: [1, { three: 1 }, { four: 3, five: { six: 1 } }] } },
|
{ one: { two: [1, { three: 1 }, { four: 3, five: { sixxx: 3 } }] } },
|
||||||
)).toBe(true);
|
{ one: { two: [1, { three: 1 }, { four: 3, five: { six: 1 } }] } }
|
||||||
|
)
|
||||||
|
).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('observeChanges test filter', () => {
|
it('observeChanges test filter', () => {
|
||||||
expect(utils.observeChanges(
|
expect(
|
||||||
{ one: { two: 2, three: 3 } },
|
utils.observeChanges(
|
||||||
{ one: { two: 2, three: 4 } },
|
{ one: { two: 2, three: 3 } },
|
||||||
{ one: ['two'] },
|
{ one: { two: 2, three: 4 } },
|
||||||
)).toBe(false);
|
{ one: ['two'] }
|
||||||
|
)
|
||||||
|
).toBe(false);
|
||||||
|
|
||||||
expect(utils.observeChanges(
|
expect(
|
||||||
{ one: { two: 2, three: 3 } },
|
utils.observeChanges(
|
||||||
{ one: { two: 1, three: 3 } },
|
{ one: { two: 2, three: 3 } },
|
||||||
{ one: ['two'] },
|
{ one: { two: 1, three: 3 } },
|
||||||
)).toBe(true);
|
{ one: ['two'] }
|
||||||
|
)
|
||||||
|
).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -5,7 +5,14 @@ describe('crypto uri parser', () => {
|
|||||||
expect(utils.parseUri('http://www.trezor.io')).toEqual({ address: '//www.trezor.io' }); // TODO: Error in function
|
expect(utils.parseUri('http://www.trezor.io')).toEqual({ address: '//www.trezor.io' }); // TODO: Error in function
|
||||||
expect(utils.parseUri('www.trezor.io')).toEqual({ address: 'www.trezor.io' });
|
expect(utils.parseUri('www.trezor.io')).toEqual({ address: 'www.trezor.io' });
|
||||||
expect(utils.parseUri('www.trezor.io/TT')).toEqual({ address: 'www.trezor.io/TT' });
|
expect(utils.parseUri('www.trezor.io/TT')).toEqual({ address: 'www.trezor.io/TT' });
|
||||||
expect(utils.parseUri('www.trezor.io/TT?param1=aha')).toEqual({ address: 'www.trezor.io/TT', param1: 'aha' });
|
expect(utils.parseUri('www.trezor.io/TT?param1=aha')).toEqual({
|
||||||
expect(utils.parseUri('www.trezor.io/TT?param1=aha¶m2=hah')).toEqual({ address: 'www.trezor.io/TT', param1: 'aha', param2: 'hah' });
|
address: 'www.trezor.io/TT',
|
||||||
|
param1: 'aha',
|
||||||
|
});
|
||||||
|
expect(utils.parseUri('www.trezor.io/TT?param1=aha¶m2=hah')).toEqual({
|
||||||
|
address: 'www.trezor.io/TT',
|
||||||
|
param1: 'aha',
|
||||||
|
param2: 'hah',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -3,36 +3,42 @@ import colors from 'config/colors';
|
|||||||
|
|
||||||
describe('device utils', () => {
|
describe('device utils', () => {
|
||||||
it('get status', () => {
|
it('get status', () => {
|
||||||
expect(utils.getStatus({ connected: false }))
|
expect(utils.getStatus({ connected: false })).toBe('disconnected');
|
||||||
.toBe('disconnected');
|
|
||||||
|
|
||||||
expect(utils.getStatus({ connected: true, available: false }))
|
expect(utils.getStatus({ connected: true, available: false })).toBe('unavailable');
|
||||||
.toBe('unavailable');
|
|
||||||
|
|
||||||
expect(utils.getStatus({
|
expect(
|
||||||
connected: true,
|
utils.getStatus({
|
||||||
available: false,
|
connected: true,
|
||||||
type: null,
|
available: false,
|
||||||
})).toBe('unavailable');
|
type: null,
|
||||||
|
})
|
||||||
|
).toBe('unavailable');
|
||||||
|
|
||||||
expect(utils.getStatus({
|
expect(
|
||||||
connected: true,
|
utils.getStatus({
|
||||||
available: true,
|
connected: true,
|
||||||
type: 'acquired',
|
available: true,
|
||||||
})).toBe('connected');
|
type: 'acquired',
|
||||||
|
})
|
||||||
|
).toBe('connected');
|
||||||
|
|
||||||
expect(utils.getStatus({
|
expect(
|
||||||
connected: true,
|
utils.getStatus({
|
||||||
available: true,
|
connected: true,
|
||||||
type: 'unacquired',
|
available: true,
|
||||||
})).toBe('unacquired');
|
type: 'unacquired',
|
||||||
|
})
|
||||||
|
).toBe('unacquired');
|
||||||
|
|
||||||
expect(utils.getStatus({
|
expect(
|
||||||
connected: true,
|
utils.getStatus({
|
||||||
available: true,
|
connected: true,
|
||||||
type: 'acquired',
|
available: true,
|
||||||
status: 'occupied',
|
type: 'acquired',
|
||||||
})).toBe('used-in-other-window');
|
status: 'occupied',
|
||||||
|
})
|
||||||
|
).toBe('used-in-other-window');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('isWebUSB', () => {
|
it('isWebUSB', () => {
|
||||||
@ -42,17 +48,13 @@ describe('device utils', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('isDisabled', () => {
|
it('isDisabled', () => {
|
||||||
expect(utils.isDisabled(
|
expect(
|
||||||
{ selectedDevice: { features: null } },
|
utils.isDisabled({ selectedDevice: { features: null } }, [1, 2, 3], {
|
||||||
[1, 2, 3],
|
|
||||||
{
|
|
||||||
version: 'webusb',
|
version: 'webusb',
|
||||||
},
|
})
|
||||||
)).toBe(false);
|
).toBe(false);
|
||||||
|
|
||||||
expect(utils.isDisabled(
|
expect(utils.isDisabled({ features: null }, [], { version: 'test' })).toBe(true);
|
||||||
{ features: null }, [], { version: 'test' },
|
|
||||||
)).toBe(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('get version', () => {
|
it('get version', () => {
|
||||||
@ -85,4 +87,4 @@ describe('device utils', () => {
|
|||||||
expect(utils.getStatusName('disconnected')).toBe('Disconnected');
|
expect(utils.getStatusName('disconnected')).toBe('Disconnected');
|
||||||
expect(utils.getStatusName('unavailable')).toBe('Unavailable');
|
expect(utils.getStatusName('unavailable')).toBe('Unavailable');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -48,6 +48,8 @@ describe('eth utils', () => {
|
|||||||
// TODO: add more tests
|
// TODO: add more tests
|
||||||
expect(utils.validateAddress('')).toBe('Address is not set');
|
expect(utils.validateAddress('')).toBe('Address is not set');
|
||||||
expect(utils.validateAddress('aaa')).toBe('Address is not valid');
|
expect(utils.validateAddress('aaa')).toBe('Address is not valid');
|
||||||
expect(utils.validateAddress('BB9bc244D798123fDe783fCc1C72d3Bb8C189413')).toBe('Address is not valid');
|
expect(utils.validateAddress('BB9bc244D798123fDe783fCc1C72d3Bb8C189413')).toBe(
|
||||||
|
'Address is not valid'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -23,4 +23,4 @@ describe('Dashboard page', () => {
|
|||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.matchImageSnapshot();
|
.matchImageSnapshot();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
const {
|
const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin');
|
||||||
addMatchImageSnapshotPlugin,
|
|
||||||
} = require('cypress-image-snapshot/plugin');
|
|
||||||
|
|
||||||
module.exports = (on) => {
|
module.exports = on => {
|
||||||
addMatchImageSnapshotPlugin(on);
|
addMatchImageSnapshotPlugin(on);
|
||||||
};
|
};
|
||||||
|
@ -3,4 +3,4 @@ import { initSeedAllDevice } from 'trezor-bridge-communicator';
|
|||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
await initSeedAllDevice();
|
await initSeedAllDevice();
|
||||||
})();
|
})();
|
||||||
|
@ -3,4 +3,4 @@ import './commands';
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
window.localStorage.setItem('/betaModalPrivacy', true);
|
window.localStorage.setItem('/betaModalPrivacy', true);
|
||||||
});
|
});
|
||||||
|
@ -16,9 +16,18 @@ const constants: Object = Object.freeze({
|
|||||||
|
|
||||||
export const { TREZOR_CONNECT_ROOT }: { TREZOR_CONNECT_ROOT: string } = constants;
|
export const { TREZOR_CONNECT_ROOT }: { TREZOR_CONNECT_ROOT: string } = constants;
|
||||||
export const TREZOR_CONNECT: string = path.join(constants.TREZOR_CONNECT_ROOT, 'src/js/index');
|
export const TREZOR_CONNECT: string = path.join(constants.TREZOR_CONNECT_ROOT, 'src/js/index');
|
||||||
export const TREZOR_IFRAME: string = path.join(constants.TREZOR_CONNECT_ROOT, 'src/js/iframe/iframe.js');
|
export const TREZOR_IFRAME: string = path.join(
|
||||||
export const TREZOR_POPUP: string = path.join(constants.TREZOR_CONNECT_ROOT, 'src/js/popup/popup.js');
|
constants.TREZOR_CONNECT_ROOT,
|
||||||
export const TREZOR_WEBUSB: string = path.join(constants.TREZOR_CONNECT_ROOT, 'src/js/webusb/index.js');
|
'src/js/iframe/iframe.js'
|
||||||
|
);
|
||||||
|
export const TREZOR_POPUP: string = path.join(
|
||||||
|
constants.TREZOR_CONNECT_ROOT,
|
||||||
|
'src/js/popup/popup.js'
|
||||||
|
);
|
||||||
|
export const TREZOR_WEBUSB: string = path.join(
|
||||||
|
constants.TREZOR_CONNECT_ROOT,
|
||||||
|
'src/js/webusb/index.js'
|
||||||
|
);
|
||||||
export const TREZOR_CONNECT_HTML: string = path.join(constants.TREZOR_CONNECT_ROOT, 'src/html/');
|
export const TREZOR_CONNECT_HTML: string = path.join(constants.TREZOR_CONNECT_ROOT, 'src/html/');
|
||||||
export const TREZOR_CONNECT_FILES: string = path.join(constants.TREZOR_CONNECT_ROOT, 'src/data/');
|
export const TREZOR_CONNECT_FILES: string = path.join(constants.TREZOR_CONNECT_ROOT, 'src/data/');
|
||||||
|
|
||||||
@ -29,10 +38,17 @@ export const {
|
|||||||
PORT,
|
PORT,
|
||||||
INDEX,
|
INDEX,
|
||||||
PUBLIC,
|
PUBLIC,
|
||||||
}: { BUILD: string, SRC: string, TRANSLATIONS: string, PORT: string, INDEX: string, PUBLIC: string } = constants;
|
}: {
|
||||||
|
BUILD: string,
|
||||||
|
SRC: string,
|
||||||
|
TRANSLATIONS: string,
|
||||||
|
PORT: string,
|
||||||
|
INDEX: string,
|
||||||
|
PUBLIC: string,
|
||||||
|
} = constants;
|
||||||
// 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 const PUBLIC: string = constants.PUBLIC;
|
||||||
|
|
||||||
export default constants;
|
export default constants;
|
||||||
|
@ -4,9 +4,7 @@ import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|||||||
import WebpackBuildNotifierPlugin from 'webpack-build-notifier';
|
import WebpackBuildNotifierPlugin from 'webpack-build-notifier';
|
||||||
import packageJson from '../package.json';
|
import packageJson from '../package.json';
|
||||||
|
|
||||||
import {
|
import { SRC, BUILD, PORT, PUBLIC, TRANSLATIONS } from './constants';
|
||||||
SRC, BUILD, PORT, PUBLIC, TRANSLATIONS,
|
|
||||||
} from './constants';
|
|
||||||
|
|
||||||
// turn on for bundle analyzing
|
// turn on for bundle analyzing
|
||||||
// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
||||||
@ -26,10 +24,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
// host: '0.0.0.0',
|
// host: '0.0.0.0',
|
||||||
contentBase: [
|
contentBase: [SRC, PUBLIC],
|
||||||
SRC,
|
|
||||||
PUBLIC,
|
|
||||||
],
|
|
||||||
stats: 'minimal',
|
stats: 'minimal',
|
||||||
hot: true,
|
hot: true,
|
||||||
https: false,
|
https: false,
|
||||||
|
@ -9,7 +9,10 @@ import {
|
|||||||
TREZOR_CONNECT_ROOT,
|
TREZOR_CONNECT_ROOT,
|
||||||
TREZOR_CONNECT_HTML,
|
TREZOR_CONNECT_HTML,
|
||||||
TREZOR_CONNECT_FILES,
|
TREZOR_CONNECT_FILES,
|
||||||
TREZOR_CONNECT, TREZOR_IFRAME, TREZOR_POPUP, TREZOR_WEBUSB,
|
TREZOR_CONNECT,
|
||||||
|
TREZOR_IFRAME,
|
||||||
|
TREZOR_POPUP,
|
||||||
|
TREZOR_WEBUSB,
|
||||||
SRC,
|
SRC,
|
||||||
BUILD,
|
BUILD,
|
||||||
PUBLIC,
|
PUBLIC,
|
||||||
@ -37,10 +40,7 @@ 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: [
|
contentBase: [SRC, PUBLIC],
|
||||||
SRC,
|
|
||||||
PUBLIC,
|
|
||||||
],
|
|
||||||
hot: true,
|
hot: true,
|
||||||
https: false,
|
https: false,
|
||||||
port: PORT,
|
port: PORT,
|
||||||
@ -102,10 +102,7 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
modules: [
|
modules: [SRC, 'node_modules', `${TREZOR_CONNECT_ROOT}/node_modules`],
|
||||||
SRC,
|
|
||||||
'node_modules',
|
|
||||||
`${TREZOR_CONNECT_ROOT}/node_modules`],
|
|
||||||
alias: {
|
alias: {
|
||||||
public: PUBLIC,
|
public: PUBLIC,
|
||||||
'trezor-connect': `${TREZOR_CONNECT}`,
|
'trezor-connect': `${TREZOR_CONNECT}`,
|
||||||
@ -152,9 +149,7 @@ module.exports = {
|
|||||||
// inject: true
|
// inject: true
|
||||||
// }),
|
// }),
|
||||||
|
|
||||||
new CopyWebpackPlugin([
|
new CopyWebpackPlugin([{ from: TREZOR_CONNECT_FILES, to: 'data' }]),
|
||||||
{ from: TREZOR_CONNECT_FILES, to: 'data' },
|
|
||||||
]),
|
|
||||||
new BundleAnalyzerPlugin({
|
new BundleAnalyzerPlugin({
|
||||||
openAnalyzer: false,
|
openAnalyzer: false,
|
||||||
analyzerMode: false, // turn on to generate bundle pass 'static'
|
analyzerMode: false, // turn on to generate bundle pass 'static'
|
||||||
@ -178,4 +173,4 @@ module.exports = {
|
|||||||
fs: 'empty',
|
fs: 'empty',
|
||||||
path: 'empty',
|
path: 'empty',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -3,9 +3,7 @@ import GitRevisionPlugin from 'git-revision-webpack-plugin';
|
|||||||
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 packageJson from '../package.json';
|
import packageJson from '../package.json';
|
||||||
import {
|
import { SRC, BUILD, PUBLIC, TRANSLATIONS } from './constants';
|
||||||
SRC, BUILD, PUBLIC, TRANSLATIONS,
|
|
||||||
} from './constants';
|
|
||||||
|
|
||||||
const gitRevisionPlugin = new GitRevisionPlugin();
|
const gitRevisionPlugin = new GitRevisionPlugin();
|
||||||
|
|
||||||
@ -77,9 +75,7 @@ module.exports = {
|
|||||||
inject: true,
|
inject: true,
|
||||||
favicon: `${SRC}images/favicon.ico`,
|
favicon: `${SRC}images/favicon.ico`,
|
||||||
}),
|
}),
|
||||||
new CopyWebpackPlugin([
|
new CopyWebpackPlugin([{ from: `${PUBLIC}`, to: './' }]),
|
||||||
{ from: `${PUBLIC}`, to: './' },
|
|
||||||
]),
|
|
||||||
new webpack.optimize.OccurrenceOrderPlugin(),
|
new webpack.optimize.OccurrenceOrderPlugin(),
|
||||||
new webpack.NoEmitOnErrorsPlugin(),
|
new webpack.NoEmitOnErrorsPlugin(),
|
||||||
new webpack.NamedModulesPlugin(),
|
new webpack.NamedModulesPlugin(),
|
||||||
|
51
yarn.lock
51
yarn.lock
@ -1421,6 +1421,11 @@ arr-union@^3.1.0:
|
|||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4"
|
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4"
|
||||||
|
|
||||||
|
array-differ@^2.0.3:
|
||||||
|
version "2.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-2.0.3.tgz#0195bb00ccccf271106efee4a4786488b7180712"
|
||||||
|
integrity sha1-AZW7AMzM8nEQbv7kpHhkiLcYBxI=
|
||||||
|
|
||||||
array-equal@^1.0.0:
|
array-equal@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93"
|
resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93"
|
||||||
@ -2672,7 +2677,7 @@ chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3:
|
|||||||
strip-ansi "^3.0.0"
|
strip-ansi "^3.0.0"
|
||||||
supports-color "^2.0.0"
|
supports-color "^2.0.0"
|
||||||
|
|
||||||
chalk@^2.0.0, chalk@^2.4.2:
|
chalk@^2.0.0, chalk@^2.3.0, chalk@^2.4.2:
|
||||||
version "2.4.2"
|
version "2.4.2"
|
||||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
|
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
|
||||||
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
|
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
|
||||||
@ -3230,7 +3235,7 @@ cross-spawn@^4.0.0:
|
|||||||
lru-cache "^4.0.1"
|
lru-cache "^4.0.1"
|
||||||
which "^1.2.9"
|
which "^1.2.9"
|
||||||
|
|
||||||
cross-spawn@^5.1.0:
|
cross-spawn@^5.0.1, cross-spawn@^5.1.0:
|
||||||
version "5.1.0"
|
version "5.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
|
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
|
||||||
integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=
|
integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=
|
||||||
@ -4486,6 +4491,19 @@ execa@0.10.0, execa@^0.10.0:
|
|||||||
signal-exit "^3.0.0"
|
signal-exit "^3.0.0"
|
||||||
strip-eof "^1.0.0"
|
strip-eof "^1.0.0"
|
||||||
|
|
||||||
|
execa@^0.8.0:
|
||||||
|
version "0.8.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/execa/-/execa-0.8.0.tgz#d8d76bbc1b55217ed190fd6dd49d3c774ecfc8da"
|
||||||
|
integrity sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=
|
||||||
|
dependencies:
|
||||||
|
cross-spawn "^5.0.1"
|
||||||
|
get-stream "^3.0.0"
|
||||||
|
is-stream "^1.1.0"
|
||||||
|
npm-run-path "^2.0.0"
|
||||||
|
p-finally "^1.0.0"
|
||||||
|
signal-exit "^3.0.0"
|
||||||
|
strip-eof "^1.0.0"
|
||||||
|
|
||||||
execa@^1.0.0:
|
execa@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8"
|
resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8"
|
||||||
@ -5758,7 +5776,7 @@ ignore-walk@^3.0.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
minimatch "^3.0.4"
|
minimatch "^3.0.4"
|
||||||
|
|
||||||
ignore@^3.3.3:
|
ignore@^3.3.3, ignore@^3.3.7:
|
||||||
version "3.3.10"
|
version "3.3.10"
|
||||||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043"
|
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043"
|
||||||
integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==
|
integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==
|
||||||
@ -7672,6 +7690,11 @@ move-concurrently@^1.0.1:
|
|||||||
rimraf "^2.5.4"
|
rimraf "^2.5.4"
|
||||||
run-queue "^1.0.3"
|
run-queue "^1.0.3"
|
||||||
|
|
||||||
|
mri@^1.1.0:
|
||||||
|
version "1.1.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.4.tgz#7cb1dd1b9b40905f1fac053abe25b6720f44744a"
|
||||||
|
integrity sha512-6y7IjGPm8AzlvoUrwAaw1tLnUBudaS3752vcd8JtrpGGQn+rXIe63LFVHm/YMwtqAuh+LJPCFdlLYPWM1nYn6w==
|
||||||
|
|
||||||
ms@2.0.0:
|
ms@2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
||||||
@ -7692,6 +7715,16 @@ multicast-dns@^6.0.1:
|
|||||||
dns-packet "^1.3.1"
|
dns-packet "^1.3.1"
|
||||||
thunky "^1.0.2"
|
thunky "^1.0.2"
|
||||||
|
|
||||||
|
multimatch@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-3.0.0.tgz#0e2534cc6bc238d9ab67e1b9cd5fcd85a6dbf70b"
|
||||||
|
integrity sha512-22foS/gqQfANZ3o+W7ST2x25ueHDVNWl/b9OlGcLpy/iKxjCpvcNCM51YCenUi7Mt/jAjjqv8JwZRs8YP5sRjA==
|
||||||
|
dependencies:
|
||||||
|
array-differ "^2.0.3"
|
||||||
|
array-union "^1.0.2"
|
||||||
|
arrify "^1.0.1"
|
||||||
|
minimatch "^3.0.4"
|
||||||
|
|
||||||
mute-stream@0.0.7:
|
mute-stream@0.0.7:
|
||||||
version "0.0.7"
|
version "0.0.7"
|
||||||
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
|
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
|
||||||
@ -8702,6 +8735,18 @@ pretty-format@^24.0.0:
|
|||||||
ansi-regex "^4.0.0"
|
ansi-regex "^4.0.0"
|
||||||
ansi-styles "^3.2.0"
|
ansi-styles "^3.2.0"
|
||||||
|
|
||||||
|
pretty-quick@^1.10.0:
|
||||||
|
version "1.10.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-1.10.0.tgz#d86cc46fe92ed8cfcfba6a082ec5949c53858198"
|
||||||
|
integrity sha512-uNvm2N3UWmnZRZrClyQI45hIbV20f5BpSyZY51Spbvn4APp9+XLyX4bCjWRGT3fGyVyQ/2/iw7dbQq1UUaq7SQ==
|
||||||
|
dependencies:
|
||||||
|
chalk "^2.3.0"
|
||||||
|
execa "^0.8.0"
|
||||||
|
find-up "^2.1.0"
|
||||||
|
ignore "^3.3.7"
|
||||||
|
mri "^1.1.0"
|
||||||
|
multimatch "^3.0.0"
|
||||||
|
|
||||||
prettylint@^1.0.0:
|
prettylint@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/prettylint/-/prettylint-1.0.0.tgz#b71720ad9733e098fdd8ebea90c61cda33371aa1"
|
resolved "https://registry.yarnpkg.com/prettylint/-/prettylint-1.0.0.tgz#b71720ad9733e098fdd8ebea90c61cda33371aa1"
|
||||||
|
Loading…
Reference in New Issue
Block a user