Skip to content

Commit

Permalink
fixed #246: there is no need to swap main script in package.json for …
Browse files Browse the repository at this point in the history
…development (#247)

* fixed #246: there is no need to swap main script in package.json for development

* fix: create tx form shows correct balance after from account changed
  • Loading branch information
gagarin55 authored Jul 9, 2017
1 parent f63386b commit fe46571
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
3 changes: 1 addition & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ Firstly: a couple things aren't working right. If you can fix either of these is

- _Issue 1_: `webpack-dev-server` isn't working right with the current babel-webpack-electron-izing
setup. So you've got to do your development in Electron for now. Which means you can't run `npm run start:web`. Bummer.
- _Issue 2_: Electron isn't playing nicely with _some_ webpack-ed javascripts, namely anything in `./electron/*.js`. This means that in `package.json` __you've got to swap__ `"main": "./electron/webpack-main.js"` to be `"main": "./electron/main.js"`. Also, please don't forget to __swap it back__ before you commit and push your changes -- the builds won't build otherwise.
With these caveats in mind, __you can run__:

Expand Down Expand Up @@ -112,7 +111,7 @@ OSX is also able to build for Linux. Add `-ml` to that raw command to build for
both OSX and Linux at the same time.

### Troubleshooting
Some prelimary things to try in case you run into issues:
Some preliminary things to try in case you run into issues:

- `rm -rf ~/Library/Application Support/EmeraldWallet` to clear out any persisted
settings or userdata from previous trials.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"build:all": "node build-electron & node build-web --for-electron",
"build:all:nowatch": "node build-electron --no-watch && node build-web --no-watch --for-electron",
"start:web": "node ./node_modules/.bin/webpack-dev-server --content-base ./app --inline --port 8000",
"start:electron": "NODE_ENV=development ./node_modules/.bin/electron -r babel-register -r babel-polyfill .",
"start:electron:getemerald": "bash dependencies.sh && NODE_ENV=development ./node_modules/.bin/electron -r babel-register -r babel-polyfill .",
"start:electron": "NODE_ENV=development ./node_modules/.bin/electron .",
"start:electron:getemerald": "bash dependencies.sh && NODE_ENV=development ./node_modules/.bin/electron .",
"test:watch": "node ./node_modules/karma/bin/karma start",
"test": "npm run build && node ./node_modules/karma/bin/karma start --single-run",
"lint": "./node_modules/eslint/bin/eslint.js ./src/",
Expand Down
2 changes: 1 addition & 1 deletion src/components/tx/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const CreateTx = connect(
onChangeAccount: (accounts, value) => {
// load account information for selected account
const idx = accounts.findKey((acct) => acct.get('id') === value);
const balance = accounts.get(idx).get('balance');
const balance = accounts.get(idx).get('balance').getEther(6);
dispatch(change('createTx', 'balance', balance.toString()));
},
onChangeToken: (event, value, prev) => {
Expand Down
30 changes: 17 additions & 13 deletions webpack.electron.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
var path = require('path');
var webpack = require('webpack');
const path = require('path');
const webpack = require('webpack');

const config = {
target: 'electron-main',
externals: [{
'electron-store': 'electron-store',
}],
entry: {
main: path.join(__dirname, 'electron', 'main.js'),
},
resolve: {
modules: [
path.resolve(path.join(__dirname, 'electron')),
path.join(__dirname, 'node_modules')
path.join(__dirname, 'node_modules'),
],
alias: {
'babel-polyfill': path.join(__dirname, 'babel-polyfill/dist/polyfill.js')
}
'babel-polyfill': path.join(__dirname, 'babel-polyfill/dist/polyfill.js'),
},
},
module: {
rules: [
Expand All @@ -23,23 +26,24 @@ const config = {
use: {
loader: 'babel-loader',
options: {
presets: ['es2015', 'react', 'stage-2']
}
}
presets: ['es2015', 'react', 'stage-2'],
},
},
},
]
],
},

output: {
path: path.join(__dirname, 'electron'),
filename: 'webpack-main.js'
filename: 'webpack-main.js',
libraryTarget: 'commonjs2',
},

plugins: [
// NODE_ENV should be production so that modules do not perform certain development checks
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
})
'process.env.NODE_ENV': JSON.stringify('production'),
}),
],

/**
Expand All @@ -49,7 +53,7 @@ const config = {
*/
node: {
__dirname: false,
__filename: false
__filename: false,
},
};

Expand Down

0 comments on commit fe46571

Please sign in to comment.