From 68f37f0f23ef76690eba9e033b111585a52d7097 Mon Sep 17 00:00:00 2001 From: Gina Contrino Date: Wed, 25 Oct 2017 11:49:02 +0200 Subject: [PATCH 01/22] Move vote methods into util to reuse in 2 places --- src/components/voting/votingBar.js | 10 ++++------ src/store/middlewares/voting.js | 4 ++-- src/utils/voting.js | 13 +++++++++++++ 3 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 src/utils/voting.js diff --git a/src/components/voting/votingBar.js b/src/components/voting/votingBar.js index 350a7688b..6ecf37903 100644 --- a/src/components/voting/votingBar.js +++ b/src/components/voting/votingBar.js @@ -4,15 +4,13 @@ import grid from 'flexboxgrid/dist/flexboxgrid.css'; import style from './votingBar.css'; import votingConst from '../../constants/voting'; +import { getTotalVotesCount, getVoteList, getUnvoteList } from './../../utils/voting'; const VotingBar = ({ votes, t }) => { const { maxCountOfVotes, maxCountOfVotesInOneTurn } = votingConst; - const votedList = Object.keys(votes).filter(key => votes[key].confirmed); - const voteList = Object.keys(votes).filter( - key => votes[key].unconfirmed && !votes[key].confirmed); - const unvoteList = Object.keys(votes).filter( - key => !votes[key].unconfirmed && votes[key].confirmed); - const totalVotesCount = (votedList.length - unvoteList.length) + voteList.length; + const voteList = getVoteList(votes); + const unvoteList = getUnvoteList(votes); + const totalVotesCount = getTotalVotesCount(votes); const totalNewVotesCount = voteList.length + unvoteList.length; return (voteList.length + unvoteList.length ? diff --git a/src/store/middlewares/voting.js b/src/store/middlewares/voting.js index 807d58d38..9da581fd9 100644 --- a/src/store/middlewares/voting.js +++ b/src/store/middlewares/voting.js @@ -5,6 +5,7 @@ import { getDelegate } from '../../utils/api/delegate'; import { voteLookupStatusUpdated, voteToggled } from '../../actions/voting'; import actionTypes from '../../constants/actions'; import votingConst from '../../constants/voting'; +import { getTotalVotesCount } from './../../utils/voting'; const updateLookupStatus = (store, list, username) => { store.dispatch(voteLookupStatusUpdated({ @@ -68,8 +69,7 @@ const checkVoteLimits = (store, action) => { store.dispatch(newAction); } - const voteCount = Object.keys(votes).filter( - key => (votes[key].confirmed && !votes[key].unconfirmed) || votes[key].unconfirmed).length; + const voteCount = getTotalVotesCount(votes); if (voteCount === votingConst.maxCountOfVotes + 1 && currentVote.unconfirmed !== currentVote.confirmed) { const label = i18next.t('Maximum of {{n}} votes exceeded.', { n: votingConst.maxCountOfVotes }); diff --git a/src/utils/voting.js b/src/utils/voting.js new file mode 100644 index 000000000..771f3439a --- /dev/null +++ b/src/utils/voting.js @@ -0,0 +1,13 @@ + +const getVotedList = votes => (Object.keys(votes).filter(key => votes[key].confirmed)); + +const getUnvoteList = votes => (Object.keys(votes).filter( + key => !votes[key].unconfirmed && votes[key].confirmed)); + +const getVoteList = votes => (Object.keys(votes).filter( + key => votes[key].unconfirmed && !votes[key].confirmed)); + +const getTotalVotesCount = votes => ((getVotedList(votes).length - getUnvoteList(votes).length) + + getVoteList(votes).length); + +export { getTotalVotesCount, getVotedList, getVoteList, getUnvoteList }; From 4fbe36f6aac51c02715b5706ff106b7cbb29ea0b Mon Sep 17 00:00:00 2001 From: reyraa Date: Wed, 25 Oct 2017 15:09:49 +0200 Subject: [PATCH 02/22] Fix typo in voteUrlProcessor --- src/components/voteUrlProcessor/voteUrlProcessor.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/voteUrlProcessor/voteUrlProcessor.js b/src/components/voteUrlProcessor/voteUrlProcessor.js index 9e8d4d715..00ee56750 100644 --- a/src/components/voteUrlProcessor/voteUrlProcessor.js +++ b/src/components/voteUrlProcessor/voteUrlProcessor.js @@ -21,7 +21,7 @@ export default class VoteUrlProcessor extends React.Component { } } - getProccessedCount() { + getProcessedCount() { return this.props.urlVoteCount - this.props.pending.length; } @@ -42,13 +42,13 @@ export default class VoteUrlProcessor extends React.Component { }; return (
- {this.getProccessedCount() < this.props.urlVoteCount ? + {this.getProcessedCount() < this.props.urlVoteCount ? (
+ value={this.getProcessedCount()} max={this.props.urlVoteCount}/>
{this.props.t('Processing delegate names: ')} - {this.getProccessedCount()} / {this.props.urlVoteCount} + {this.getProcessedCount()} / {this.props.urlVoteCount}
) : ({Object.keys(errorMessages).map(list => ( From 312fe4c8ba20b9a2a37d6d58bcdfd6c27569fc05 Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 16:04:35 +0200 Subject: [PATCH 03/22] Add inputWrapper class to passphraseInput.css --- src/components/passphraseInput/passphraseInput.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/passphraseInput/passphraseInput.css b/src/components/passphraseInput/passphraseInput.css index 66080d7b0..71adca744 100644 --- a/src/components/passphraseInput/passphraseInput.css +++ b/src/components/passphraseInput/passphraseInput.css @@ -16,3 +16,7 @@ height: 24px; cursor: pointer; } + +.inputWrapper input { + padding-right: 35px; +} From daf6ba15615523dec87fa626107215c13b9a0e85 Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 16:04:56 +0200 Subject: [PATCH 04/22] Use inputWrapper class in passphraseInput component --- src/components/passphraseInput/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/passphraseInput/index.js b/src/components/passphraseInput/index.js index 6c8c8c654..b81095b3f 100644 --- a/src/components/passphraseInput/index.js +++ b/src/components/passphraseInput/index.js @@ -78,7 +78,7 @@ class PassphraseInput extends React.Component { return (
Date: Wed, 25 Oct 2017 16:16:59 +0200 Subject: [PATCH 05/22] Remove unused actions from voteUrlProcessor --- src/components/voteUrlProcessor/index.js | 4 ---- src/components/voteUrlProcessor/index.test.js | 14 -------------- 2 files changed, 18 deletions(-) diff --git a/src/components/voteUrlProcessor/index.js b/src/components/voteUrlProcessor/index.js index ff5c2a8e4..e2765d003 100644 --- a/src/components/voteUrlProcessor/index.js +++ b/src/components/voteUrlProcessor/index.js @@ -5,8 +5,6 @@ import { withRouter } from 'react-router'; import { urlVotesFound, voteLookupStatusCleared, - voteToggled, - votesAdded, } from '../../actions/voting'; import VoteUrlProcessor from './voteUrlProcessor'; @@ -28,8 +26,6 @@ const mapStateToProps = state => ({ }); const mapDispatchToProps = dispatch => ({ - voteToggled: data => dispatch(voteToggled(data)), - votesAdded: data => dispatch(votesAdded(data)), urlVotesFound: data => dispatch(urlVotesFound(data)), clearVoteLookupStatus: () => dispatch(voteLookupStatusCleared()), }); diff --git a/src/components/voteUrlProcessor/index.test.js b/src/components/voteUrlProcessor/index.test.js index 40e8979a4..a69f8ea2e 100644 --- a/src/components/voteUrlProcessor/index.test.js +++ b/src/components/voteUrlProcessor/index.test.js @@ -42,20 +42,6 @@ describe('VoteUrlProcessorHOC', () => { expect(wrapper.find(VoteUrlProcessor)).to.have.lengthOf(1); }); - it('should bind voteToggled action to VoteUrlProcessor props.voteToggled', () => { - const actionsSpy = sinon.spy(votingActions, 'voteToggled'); - wrapper.find(VoteUrlProcessor).props().voteToggled(actionData); - expect(actionsSpy).to.be.calledWith(actionData); - actionsSpy.restore(); - }); - - it('should bind votesAdded action to VoteUrlProcessor props.votesAdded', () => { - const actionsSpy = sinon.spy(votingActions, 'votesAdded'); - wrapper.find(VoteUrlProcessor).props().votesAdded(actionData); - expect(actionsSpy).to.be.calledWith(actionData); - actionsSpy.restore(); - }); - it('should bind urlVotesFound action to VoteUrlProcessor props.urlVotesFound', () => { const actionMock = sinon.mock(votingActions); actionMock.expects('urlVotesFound').withExactArgs(actionData).returns({ type: 'DUMMY' }); From 6e44d49d44392cc71481932256567fb3aced213f Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 16:44:48 +0200 Subject: [PATCH 06/22] Remove i18next from networks constant --- src/components/login/networks.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/login/networks.js b/src/components/login/networks.js index 6b060d439..dcb385ec8 100644 --- a/src/components/login/networks.js +++ b/src/components/login/networks.js @@ -1,17 +1,15 @@ -import i18next from 'i18next'; - export default () => ([ { - name: i18next.t('Mainnet'), + name: 'Mainnet', ssl: true, port: 443, }, { - name: i18next.t('Testnet'), + name: 'Testnet', testnet: true, ssl: true, port: 443, }, { - name: i18next.t('Custom Node'), + name: 'Custom Node', custom: true, address: 'http://localhost:4000', }, From 91d36e52947bdcc74937ddc1e59340d4438ee75c Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 16:45:58 +0200 Subject: [PATCH 07/22] Fix networks translation bug --- src/components/login/login.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/login/login.js b/src/components/login/login.js index 41628f22a..29fbb1464 100644 --- a/src/components/login/login.js +++ b/src/components/login/login.js @@ -3,6 +3,7 @@ import grid from 'flexboxgrid/dist/flexboxgrid.css'; import Input from 'react-toolbox/lib/input'; import Dropdown from 'react-toolbox/lib/dropdown'; import Button from 'react-toolbox/lib/button'; +import i18next from 'i18next'; import getNetworks from './networks'; import PassphraseInput from '../passphraseInput'; import styles from './login.css'; @@ -34,10 +35,17 @@ class Login extends React.Component { componentWillMount() { this.networks = getNetworks().map((network, index) => ({ - label: network.name, + label: i18next.t(network.name), value: index, })); + i18next.on('languageChanged', () => { + this.networks = getNetworks().map((network, index) => ({ + label: i18next.t(network.name), + value: index, + })); + }); + this.props.accountsRetrieved(); } From 73193a8d21445568c9706fa136e5d09bbc2865f5 Mon Sep 17 00:00:00 2001 From: Gina Contrino Date: Wed, 25 Oct 2017 17:16:49 +0200 Subject: [PATCH 08/22] Fix port and version bug --- src/actions/peers.js | 7 ++++--- src/actions/peers.test.js | 20 +++++++++++++++++--- src/constants/netHashes.js | 5 +++++ 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 src/constants/netHashes.js diff --git a/src/actions/peers.js b/src/actions/peers.js index 98324b2cb..14b50b57b 100644 --- a/src/actions/peers.js +++ b/src/actions/peers.js @@ -3,6 +3,7 @@ import Lisk from 'lisk-js'; import actionTypes from '../constants/actions'; import { getNethash } from './../utils/api/nethash'; import { errorToastDisplayed } from './toaster'; +import netHashes from '../constants/netHashes'; const peerSet = (data, config) => ({ data: Object.assign({ @@ -33,15 +34,15 @@ export const activePeerSet = data => const { hostname, port, protocol } = new URL(addHttp(config.address)); config.node = hostname; - config.port = port; - config.ssl = protocol === 'https'; + config.ssl = protocol === 'https:'; + config.port = port || (config.ssl ? 443 : 80); } if (config.testnet === undefined && config.port !== undefined) { config.testnet = config.port === '7000'; } if (config.custom) { getNethash(Lisk.api(config)).then((response) => { - config.nethash = response.nethash; + config.testnet = response.nethash === netHashes.testnet; dispatch(peerSet(data, config)); }).catch(() => { dispatch(errorToastDisplayed({ label: i18next.t('Unable to connect to the node') })); diff --git a/src/actions/peers.test.js b/src/actions/peers.test.js index d29afa900..d407d4ea8 100644 --- a/src/actions/peers.test.js +++ b/src/actions/peers.test.js @@ -1,6 +1,7 @@ import { expect } from 'chai'; import { spy, stub, match } from 'sinon'; import actionTypes from '../constants/actions'; +import netHashes from '../constants/netHashes'; import { activePeerSet, activePeerUpdate } from './peers'; import * as nethashApi from './../utils/api/nethash'; @@ -63,7 +64,7 @@ describe('actions: peers', () => { expect(dispatch).to.have.been.calledWith(match.hasNested('data.activePeer.options.address', 'localhost:8000')); }); - it('dispatch activePeerSet with nethash from response when the network is a custom node', () => { + it('dispatch activePeerSet with testnet config set to true when the network is a custom node and nethash is testnet', () => { getNetHash.returnsPromise(); const network = { address: 'http://localhost:4000', @@ -71,9 +72,22 @@ describe('actions: peers', () => { }; activePeerSet({ passphrase, network })(dispatch); - getNetHash.resolves({ nethash: 'nethash from response' }); + getNetHash.resolves({ nethash: netHashes.testnet }); - expect(dispatch).to.have.been.calledWith(match.hasNested('data.activePeer.nethash.nethash', 'nethash from response')); + expect(dispatch).to.have.been.calledWith(match.hasNested('data.activePeer.testnet', true)); + }); + + it('dispatch activePeerSet with testnet config set to false when the network is a custom node and nethash is testnet', () => { + getNetHash.returnsPromise(); + const network = { + address: 'http://localhost:4000', + custom: true, + }; + + activePeerSet({ passphrase, network })(dispatch); + getNetHash.resolves({ nethash: 'some other nethash' }); + + expect(dispatch).to.have.been.calledWith(match.hasNested('data.activePeer.testnet', false)); }); it('dispatch activePeerSet action even if network is undefined', () => { diff --git a/src/constants/netHashes.js b/src/constants/netHashes.js new file mode 100644 index 000000000..4be6e5cf0 --- /dev/null +++ b/src/constants/netHashes.js @@ -0,0 +1,5 @@ +const netHash = { + testnet: 'da3ed6a45429278bac2666961289ca17ad86595d33b31037615d4b8e8f158bba', +}; + +export default netHash; From 3f44a8e15c5e896f4ec8d106dd124e5dd84c6203 Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 18:04:50 +0200 Subject: [PATCH 09/22] add translations strings to networks.js --- src/components/login/networks.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/login/networks.js b/src/components/login/networks.js index dcb385ec8..1ee4b8113 100644 --- a/src/components/login/networks.js +++ b/src/components/login/networks.js @@ -1,14 +1,14 @@ export default () => ([ - { + {// network name translation t('Mainnet'); name: 'Mainnet', ssl: true, port: 443, - }, { + }, {// network name translation t('Testnet'); name: 'Testnet', testnet: true, ssl: true, port: 443, - }, { + }, {// network name translation t('Custom Node'); name: 'Custom Node', custom: true, address: 'http://localhost:4000', From acad78cdd83f9a5795233cab0f0f4407a4bebe84 Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 18:05:45 +0200 Subject: [PATCH 10/22] Add network names to common.json --- src/locales/en/common.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/locales/en/common.json b/src/locales/en/common.json index 3b65aca1e..35c2876af 100644 --- a/src/locales/en/common.json +++ b/src/locales/en/common.json @@ -182,16 +182,15 @@ "Zero not allowed": "Zero not allowed", "confirmation": "confirmation", "confirmations": "confirmations", - "key": "key", "logout": "logout", "my votes": "my votes", "send": "send", "your passphrase will be required for logging in to your account.": "your passphrase will be required for logging in to your account.", "your second passphrase will be required for all transactions sent from this account": "your second passphrase will be required for all transactions sent from this account", - "{{count}} delegate names were successfully resolved for voting.": "{{count}} delegate name successfully resolved to add vote to.", - "{{count}} delegate names were successfully resolved for voting._plural": "{{count}} delegate names were successfully resolved for voting.", "{{count}} delegate names were successfully resolved for unvoting.": "{{count}} delegate name successfully resolved to remove vote from.", "{{count}} delegate names were successfully resolved for unvoting._plural": "{{count}} delegate names were successfully resolved for unvoting.", + "{{count}} delegate names were successfully resolved for voting.": "{{count}} delegate name successfully resolved to add vote to.", + "{{count}} delegate names were successfully resolved for voting._plural": "{{count}} delegate names were successfully resolved for voting.", "{{count}} of the delegate names selected for unvoting was not currently voted for:": "{{count}} of the delegate names selected for unvoting was not currently voted for:", "{{count}} of the delegate names selected for unvoting was not currently voted for:_plural": "{{count}} of the delegate names selected for unvoting were not currently voted for:", "{{count}} of the delegate names selected for voting was already voted for for:": "{{count}} of the delegate names selected for voting was already voted for for:", From 48f4b1d8a1b0b554a38569948e16ba5ff73f4841 Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 18:07:42 +0200 Subject: [PATCH 11/22] Translate network name in account component --- src/components/account/account.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/account/account.js b/src/components/account/account.js index 40bb821d0..86507309b 100644 --- a/src/components/account/account.js +++ b/src/components/account/account.js @@ -38,7 +38,7 @@ const Account = ({ {status}

- {peers.data.options.name} + {t(peers.data.options.name)}

{peers.data.currentPeer} From 4964fe50b311ac04501b2752c74bc9457ebd6b3c Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 18:22:52 +0200 Subject: [PATCH 12/22] Fix a bug in login component --- src/components/login/login.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/login/login.js b/src/components/login/login.js index 29fbb1464..5cc5b1a43 100644 --- a/src/components/login/login.js +++ b/src/components/login/login.js @@ -34,20 +34,20 @@ class Login extends React.Component { } componentWillMount() { - this.networks = getNetworks().map((network, index) => ({ - label: i18next.t(network.name), - value: index, - })); - + this.getNetworksList(); i18next.on('languageChanged', () => { - this.networks = getNetworks().map((network, index) => ({ - label: i18next.t(network.name), - value: index, - })); + this.getNetworksList(); }); this.props.accountsRetrieved(); } + + getNetworksList() { + this.networks = getNetworks().map((network, index) => ({ + label: i18next.t(network.name), + value: index, + })); + } componentDidUpdate() { if (this.props.account && this.props.account.address) { From 690439b12f94dd377f05f8f80bf7eff9cb177e30 Mon Sep 17 00:00:00 2001 From: yasharAyari Date: Wed, 25 Oct 2017 18:34:58 +0200 Subject: [PATCH 13/22] Fix a eslint bug in login component --- src/components/login/login.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/login/login.js b/src/components/login/login.js index 5cc5b1a43..6bcc4bc85 100644 --- a/src/components/login/login.js +++ b/src/components/login/login.js @@ -41,7 +41,7 @@ class Login extends React.Component { this.props.accountsRetrieved(); } - + getNetworksList() { this.networks = getNetworks().map((network, index) => ({ label: i18next.t(network.name), From 8f9be32f38a7bc75531bd33f2db74bc9936f62dc Mon Sep 17 00:00:00 2001 From: reyraa Date: Wed, 25 Oct 2017 18:40:38 +0200 Subject: [PATCH 14/22] Update the list only if vote.refresh is changed to true --- src/components/voting/voting.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/voting/voting.js b/src/components/voting/voting.js index bfd7b365e..63426f2a0 100644 --- a/src/components/voting/voting.js +++ b/src/components/voting/voting.js @@ -23,11 +23,10 @@ class Voting extends React.Component { } componentWillUpdate(nextProps) { - setTimeout(() => { - if (this.props.refreshDelegates) { - this.loadVotedDelegates(true); - } - }, 1); + if (!this.props.refreshDelegates && nextProps.refreshDelegates) { + this.loadVotedDelegates(true); + } + if (this.props.delegates.length < nextProps.delegates.length) { setTimeout(() => { this.freezeLoading = false; From 94d85b0911edd916eac7d6efcaef5f209c0f28a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Stanislav?= Date: Wed, 25 Oct 2017 11:51:08 +0100 Subject: [PATCH 15/22] Fix clean and copy scripts on windows --- Jenkinsfile | 2 +- package.json | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 459e91c34..cbda8cd0b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -62,7 +62,7 @@ node('lisk-nano') { stage ('Run Eslint') { try { ansiColor('xterm') { - sh 'npm run --silent clean && npm run --silent copy-files && npm run --silent eslint' + sh 'npm run --silent clean-build && npm run --silent copy-files && npm run --silent eslint' } } catch (err) { echo "Error: ${err}" diff --git a/package.json b/package.json index ad6b99283..18b890900 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "bugs": "https://github.com/LiskHQ/lisk-nano/issues", "main": "main.js", "scripts": { - "build": "npm run clean && npm run copy-files && npm run build-prod && npm run build-electron", + "build": "npm run clean-build && npm run copy-files && npm run build-prod && npm run build-electron", "dev": "webpack-dev-server --config ./config/webpack.config.dev --env.dev --hot", "build-prod": "webpack --config ./config/webpack.config.prod --env.prod", "build-electron": "webpack --config ./config/webpack.config.electron", @@ -17,8 +17,8 @@ "dist:win": "build --win --ia32 --x64", "dist:mac": "build --mac", "dist:linux": "build --linux --ia32 --x64 --armv7l", - "copy-files": "mkdir app/build && cp -r ./src/index.html ./src/assets ./src/locales ./app/build", - "clean": "del app/build -f", + "copy-files": "cpx \"./src/{index.html,assets/**/*,locales/**/*}\" ./app/build/", + "clean-build": "rm -rf app/build", "eslint": "eslint ./src/ ./app/src/ ./app/config/ ./features/", "storybook": "start-storybook -p 6006 -s ./src/", "i18n-scanner": "node ./src/i18n-scanner.js", @@ -75,6 +75,7 @@ "chai": "4.1.2", "chai-as-promised": "7.1.1", "chai-enzyme": "0.8.0", + "cpx": "=1.5.0", "css-hot-loader": "=1.3.1", "css-loader": "0.28.7", "cucumber": "2.2.0", From 99584cc571f921c0d6ad0d5e4d5795667780d3ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Stanislav?= Date: Wed, 25 Oct 2017 11:52:15 +0100 Subject: [PATCH 16/22] Add npm pack scripts for building packages --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index 18b890900..f7219d62d 100644 --- a/package.json +++ b/package.json @@ -14,12 +14,16 @@ "test": "karma start", "test-live": "npm test -- --auto-watch --no-single-run", "start": "electron ./app/", + "dist": "build --ia32 --x64 --armv7l", "dist:win": "build --win --ia32 --x64", "dist:mac": "build --mac", "dist:linux": "build --linux --ia32 --x64 --armv7l", "copy-files": "cpx \"./src/{index.html,assets/**/*,locales/**/*}\" ./app/build/", "clean-build": "rm -rf app/build", + "clean-dist": "rm -rf dist", "eslint": "eslint ./src/ ./app/src/ ./app/config/ ./features/", + "pack": "npm install && npm run build && npm run clean-dist && npm run dist", + "pack:win": "cmd /c npm install && npm run clean-build && npm run copy-files && npm run build-prod && npm run build-electron && npm run clean-dist && npm run dist:win", "storybook": "start-storybook -p 6006 -s ./src/", "i18n-scanner": "node ./src/i18n-scanner.js", "build-storybook": "build-storybook" From fccb2bc79df915893852e62f23efef293afa3e68 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Wed, 25 Oct 2017 15:05:01 +0200 Subject: [PATCH 17/22] Update README with new npm run pack commands --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 32ec7647d..48006f1c6 100644 --- a/README.md +++ b/README.md @@ -58,26 +58,26 @@ npm run start ### Windows -Build package for Windows. +Build package for Windows (on Windows in [Git BASH](https://git-for-windows.github.io/)). ``` -npm run dist:win +npm run pack:win ``` ### macOS -Build package for macOS. +Build package for macOS (on macOs) ``` -npm run dist:mac +npm run pack ``` ### Linux -Build package for Linux. +Build package for Linux (on Linux). ``` -npm run dist:linux +npm run pack ``` ## Run unit tests From c15febcb56017f09628344ba826b4d1738e587dc Mon Sep 17 00:00:00 2001 From: Gina Contrino Date: Thu, 26 Oct 2017 10:00:09 +0200 Subject: [PATCH 18/22] Add nethash to config when nethash is neither testnet nor mainnet --- src/actions/peers.js | 3 +++ src/constants/netHashes.js | 1 + 2 files changed, 4 insertions(+) diff --git a/src/actions/peers.js b/src/actions/peers.js index 14b50b57b..411a93c95 100644 --- a/src/actions/peers.js +++ b/src/actions/peers.js @@ -43,6 +43,9 @@ export const activePeerSet = data => if (config.custom) { getNethash(Lisk.api(config)).then((response) => { config.testnet = response.nethash === netHashes.testnet; + if (!config.testnet && response.nethash !== netHashes.mainnet) { + config.nethash = response.nethash; + } dispatch(peerSet(data, config)); }).catch(() => { dispatch(errorToastDisplayed({ label: i18next.t('Unable to connect to the node') })); diff --git a/src/constants/netHashes.js b/src/constants/netHashes.js index 4be6e5cf0..5c9baac29 100644 --- a/src/constants/netHashes.js +++ b/src/constants/netHashes.js @@ -1,5 +1,6 @@ const netHash = { testnet: 'da3ed6a45429278bac2666961289ca17ad86595d33b31037615d4b8e8f158bba', + mainnet: 'ed14889723f24ecc54871d058d98ce91ff2f973192075c0155ba2b7b70ad2511', }; export default netHash; From aa5e3960e5cfecd52abdb795e59c8a2956c51205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Stanislav?= Date: Thu, 26 Oct 2017 22:29:52 +0200 Subject: [PATCH 19/22] Fix launch protocol on Linux - Closes #909 --- app/src/main.js | 8 ++++---- package.json | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/main.js b/app/src/main.js index 30afc92a2..10613c30f 100644 --- a/app/src/main.js +++ b/app/src/main.js @@ -70,8 +70,8 @@ function createWindow() { win.on('blur', () => win.webContents.send('blur')); win.on('focus', () => win.webContents.send('focus')); - if (process.platform === 'win32') { - sendUrlToRouter(process.argv.slice(1)); + if (process.platform !== 'darwin') { + sendUrlToRouter(process.argv[1] || '/'); } Menu.setApplicationMenu(buildMenu(app, copyright, i18n)); @@ -142,8 +142,8 @@ app.setAsDefaultProtocolClient(protocolName); // Force single instance application const isSecondInstance = app.makeSingleInstance((argv) => { - if (process.platform === 'win32') { - sendUrlToRouter(argv.slice(1)); + if (process.platform !== 'darwin') { + sendUrlToRouter(argv[1] || '/'); } if (win) { if (win.isMinimized()) win.restore(); diff --git a/package.json b/package.json index ad6b99283..bee823905 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "css-loader": "0.28.7", "cucumber": "2.2.0", "del-cli": "1.1.0", - "electron": "1.7.8", + "electron": "1.8.1", "electron-builder": "19.32.2", "electron-json-storage": "^3.2.0", "enzyme": "2.9.1", @@ -149,7 +149,11 @@ "deb", "rpm", "tar.gz" - ] + ], + "desktop": { + "MimeType": "application/lisk;x-scheme-handler/lisk" + }, + "category": "Network" }, "win": { "target": "nsis" From 1c8d9168d33933295f179707504524848c8591a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Stanislav?= Date: Fri, 6 Oct 2017 10:40:37 +0100 Subject: [PATCH 20/22] Add linebreak-style eslint rule --- .eslintrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc b/.eslintrc index ae5f55396..a51dbfb2a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -46,6 +46,7 @@ ] } ], + "linebreak-style": ["error", "unix"], "no-param-reassign": "off" } } From 4bc329a56de81989cfca4535f83bc6af4ca528d2 Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Wed, 18 Oct 2017 11:40:27 +0200 Subject: [PATCH 21/22] Fix e2e test .eslintrc to extend root .eslintrc --- features/.eslintrc.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/features/.eslintrc.json b/features/.eslintrc.json index 91809cf85..a075509cf 100644 --- a/features/.eslintrc.json +++ b/features/.eslintrc.json @@ -1,12 +1,6 @@ { - "extends": "airbnb-base", - "plugins": [ - "import" - ], + "extends": "../.eslintrc", "env": { "protractor": true - }, - "rules": { - "no-underscore-dangle": "off" } } From 5920a1c4d59f7eba8a5b1950ea777508b5b13574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Stanislav?= Date: Wed, 18 Oct 2017 10:41:58 +0100 Subject: [PATCH 22/22] Disable linebreak-style rule --- .eslintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index a51dbfb2a..31e09235f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -46,7 +46,7 @@ ] } ], - "linebreak-style": ["error", "unix"], + "linebreak-style": 0, "no-param-reassign": "off" } }