From 9fc8c13d7d4c54d5859c00a25a8c4f0120548d30 Mon Sep 17 00:00:00 2001 From: serapath Date: Sat, 18 Mar 2017 14:10:52 +0700 Subject: [PATCH] REFACTOR npm scripts & minor code corrections --- .babelrc | 29 ---------- README.md | 31 +++++++--- package.json | 73 ++++++++++++------------ src/ui/TreeView.js | 4 -- test/astwalker.js | 2 +- test/codeManager.js | 8 +-- test/disassembler.js | 2 +- test/eventManager.js | 2 +- test/index.js | 2 +- test/solidity/decodeInfo.js | 2 +- test/solidity/localDecoder.js | 4 +- test/solidity/localsTests/helper.js | 2 +- test/solidity/localsTests/int.js | 14 ++--- test/solidity/localsTests/misc.js | 14 ++--- test/solidity/localsTests/misc2.js | 14 ++--- test/solidity/localsTests/structArray.js | 14 ++--- test/solidity/storageDecoder.js | 2 +- test/solidity/storageLocation.js | 2 +- test/sourceMappingDecoder.js | 2 +- test/traceManager.js | 6 +- test/util.js | 4 +- 21 files changed, 108 insertions(+), 125 deletions(-) delete mode 100644 .babelrc diff --git a/.babelrc b/.babelrc deleted file mode 100644 index d7614673f4..0000000000 --- a/.babelrc +++ /dev/null @@ -1,29 +0,0 @@ -{ - "plugins": [["fast-async", { - "runtimePatten": null, - "compiler": { - "promises": true, - "es7": true, - "noRuntime": true, - "wrapAwait": true - } - }], - "check-es2015-constants", - "transform-es2015-arrow-functions", - "transform-es2015-block-scoped-functions", - "transform-es2015-block-scoping", - "transform-es2015-classes", - "transform-es2015-computed-properties", - "transform-es2015-destructuring", - "transform-es2015-duplicate-keys", - "transform-es2015-for-of", - "transform-es2015-function-name", - "transform-es2015-literals", - "transform-es2015-object-super", - "transform-es2015-parameters", - "transform-es2015-shorthand-properties", - "transform-es2015-spread", - "transform-es2015-sticky-regex", - "transform-es2015-unicode-regex", - ] -} \ No newline at end of file diff --git a/README.md b/README.md index d4bce539d6..8191743de3 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ Ethereum IDE and tools for the web ## REMIX WEBSITE: -Remix is avalaible at http://ethereum.github.io/remix. +Remix is avalaible at http://ethereum.github.io/remix. You can use it either inside Mist or by connecting to geth or eth. -Note that connecting to Geth does not work through https. +Note that connecting to Geth does not work through https. You'll have to run your own node using the following parameters: @@ -16,7 +16,7 @@ You'll have to run your own node using the following parameters: Using Geth: geth --rpc --rpcapi 'web3,eth,debug' --rpcport 8545 --rpccorsdomain '*' - + Using Eth: eth -j --rpccorsdomain '*' @@ -32,11 +32,24 @@ Brief instructions to build for linux(Todo add other platforms) we will add deta Install eth or geth, npm and node.js (see https://docs.npmjs.com/getting-started/installing-node), then do: - git clone https://github.com/ethereum/remix - cd remix - npm install && npm run build && npm run start_node + * `git clone https://github.com/ethereum/remix` + * `cd remix` + * `npm install` + * `npm start` + +open `remix/index.html` in your browser. + +## TEST: + +For unit tests run `npm test` -open remix/index.html in your browser. +For local headless browser tests run `npm run test-browser` + +## DEVELOPING: + +Run `npm run start_dev` and open `http://10.5.50.211:8080` in your browser. + +Start developing and see your browser live reload when you save files ## REMIX First Step: @@ -45,7 +58,7 @@ There's two way of doing that: - using a block number and a transaction index. - using a transaction hash. -When loading the transaction succeed, the hash, from and to field will show up. +When loading the transaction succeed, the hash, from and to field will show up. Then the vm trace is loaded. The debugger itself contains several controls that allow stepping over the trace and seing the current state of a selected step. @@ -61,7 +74,7 @@ Stepping actions are: - Jump Next Call (this will select the next state that refers to a context changes - CALL, CALLCODE, DELEGATECALL, CREATE) #### State Viewer: - + The upper right panel contains basic informations about the current step: - VMTraceStep: the index in the trace of the current step. - Step diff --git a/package.json b/package.json index 20731c7285..ba0cd66892 100644 --- a/package.json +++ b/package.json @@ -17,59 +17,49 @@ "which": "^1.2.10" }, "devDependencies": { - "babel-cli": "^6.16.0", "babel-eslint": "^7.1.1", - "babel-plugin-check-es2015-constants": "^6.8.0", - "babel-plugin-transform-es2015-arrow-functions": "^6.8.0", - "babel-plugin-transform-es2015-block-scoped-functions": "^6.8.0", - "babel-plugin-transform-es2015-block-scoping": "^6.18.0", - "babel-plugin-transform-es2015-classes": "^6.18.0", - "babel-plugin-transform-es2015-computed-properties": "^6.8.0", - "babel-plugin-transform-es2015-destructuring": "^6.18.0", - "babel-plugin-transform-es2015-duplicate-keys": "^6.8.0", - "babel-plugin-transform-es2015-for-of": "^6.18.0", - "babel-plugin-transform-es2015-function-name": "^6.9.0", - "babel-plugin-transform-es2015-literals": "^6.8.0", - "babel-plugin-transform-es2015-object-super": "^6.8.0", - "babel-plugin-transform-es2015-parameters": "^6.18.0", - "babel-plugin-transform-es2015-shorthand-properties": "^6.18.0", - "babel-plugin-transform-es2015-spread": "^6.8.0", - "babel-plugin-transform-es2015-sticky-regex": "^6.8.0", - "babel-plugin-transform-es2015-template-literals": "^6.8.0", - "babel-plugin-transform-es2015-unicode-regex": "^6.11.0", - "babel-plugin-transform-regenerator": "^6.16.1", + "babel-preset-es2015": "^6.24.0", "babelify": "^7.3.0", "browserify": "^13.0.1", "ethereum-common": "0.0.18", + "ethereumjs-block": "^1.2.2", + "ethereumjs-tx": "^1.1.1", "ethereumjs-util": "^4.5.0", + "ethereumjs-vm": "^2.0.1", "fast-async": "^6.1.2", "http-server": "^0.9.0", "nightwatch": "^0.9.5", + "selenium-standalone": "^6.0.1", "solc": "^0.4.3", "standard": "^7.0.1", "standard-reporter": "^1.0.5", "tape": "^4.6.0", "web3": "^0.15.3", "yo-yo": "^1.2.1", - "yo-yoify": "^3.1.0", - "ethereumjs-block": "^1.2.2", - "ethereumjs-tx": "^1.1.1", - "ethereumjs-vm": "^2.0.1" + "yo-yoify": "^3.1.0" }, "scripts": { - "start_node": "./runNode.sh", - "start_eth": "npm run warning_message; eth -j --rpccorsdomain '*'", - "start_geth": "npm run warning_message; geth --rpc --rpcapi 'web3,eth,debug' --rpcport 8545 --rpccorsdomain '*'", - "build": "mkdir build; browserify src/index.js -g yo-yoify -o build/app.js -t [ babelify ]; babel --plugins=transform-es2015-template-literals build/app.js --out-file build/app.js", - "test": "standard; babel src --out-dir babelify-src; tape ./test/tests.js", - "serve": "http-server .", + "build": "mkdirp build; browserify src/index.js > build/app.js", + "lint": "standard | notify-error", "nightwatch_local": "nightwatch --config nightwatch.js --env local", - "nightwatch_remote_firefox": "nightwatch --config nightwatch.js --env default", "nightwatch_remote_chrome": "nightwatch --config nightwatch.js --env chrome", - "nightwatch_remote_safari": "nightwatch --config nightwatch.js --env safari", + "nightwatch_remote_firefox": "nightwatch --config nightwatch.js --env default", "nightwatch_remote_ie": "nightwatch --config nightwatch.js --env ie", "nightwatch_remote_parallel": "nightwatch --config nightwatch.js --env ie,safari,chrome,default", - "warning_message": "echo 'DO NOT DO THIS IF eth/geth STORES PRIVATE KEYS!! External system might be able to access your node through the RPC server.\n\n';" + "nightwatch_remote_safari": "nightwatch --config nightwatch.js --env safari", + "onchange": "onchange build/app.js -- npm run lint", + "prepublish": "npm run build && selenium-standalone install", + "selenium": "selenium-standalone start", + "serve": "http-server .", + "start": "./runNode.sh", + "start_dev": "npm-run-all -lpr serve watch onchange", + "start_eth": "npm run warning_message; eth -j --rpccorsdomain '*'", + "start_geth": "npm run warning_message; geth --rpc --rpcapi 'web3,eth,debug' --rpcport 8545 --rpccorsdomain '*'", + "test": "standard; tape ./test/tests.js", + "test-browser": "npm-run-all -lpr selenium serve waittest", + "waittest": "sleep 5 && npm run nightwatch_local", + "warning_message": "echo 'DO NOT DO THIS IF eth/geth STORES PRIVATE KEYS!! External system might be able to access your node through the RPC server.\n\n';", + "watch": "mkdirp build; watchify src/index.js -p [ browserify-livereload --host 127.0.0.1 --port 1337 ] -dv -o build/app.js" }, "repository": { "type": "git", @@ -91,8 +81,21 @@ }, "browserify": { "transform": [ - ["babelify"], - ["yo-yoify"] + ["babelify", { + "plugins": [ + ["fast-async", { + "runtimePatten": null, + "compiler": { + "promises": true, + "es7": true, + "noRuntime": true, + "wrapAwait": true + } + }] + ] + }], + ["yo-yoify"], + ["babelify", { "presets": ["es2015"] }] ] } } diff --git a/src/ui/TreeView.js b/src/ui/TreeView.js index 71269f15f3..3d7c5ec38f 100644 --- a/src/ui/TreeView.js +++ b/src/ui/TreeView.js @@ -6,10 +6,6 @@ var ui = require('../helpers/ui') class TreeView { constructor (opts) { - function noop (node) { - } - this.beforeJsonNodeRendered = opts.beforeJsonNodeRendered || noop - this.beforeJsonValueRendered = opts.beforeJsonValueRendered || noop this.extractData = opts.extractData || this.extractDataDefault this.formatSelf = opts.formatSelf || this.formatSelfDefault this.view = null diff --git a/test/astwalker.js b/test/astwalker.js index c33e2467c8..49bcf2a714 100644 --- a/test/astwalker.js +++ b/test/astwalker.js @@ -1,6 +1,6 @@ 'use strict' var tape = require('tape') -var AstWalker = require('../babelify-src/util/astWalker') +var AstWalker = require('../src/util/astWalker') var node = require('./resources/ast') tape('ASTWalker', function (t) { diff --git a/test/codeManager.js b/test/codeManager.js index df73a88a8e..948e6d3d88 100644 --- a/test/codeManager.js +++ b/test/codeManager.js @@ -1,10 +1,10 @@ 'use strict' var tape = require('tape') -var Web3Providers = require('../babelify-src/web3Provider/web3Providers') -var TraceManager = require('../babelify-src/trace/traceManager') -var CodeManager = require('../babelify-src/code/codeManager') +var Web3Providers = require('../src/web3Provider/web3Providers') +var TraceManager = require('../src/trace/traceManager') +var CodeManager = require('../src/code/codeManager') var web3Test = require('./resources/testWeb3') -var util = require('../babelify-src/helpers/global') +var util = require('../src/helpers/global') tape('CodeManager', function (t) { var codeManager diff --git a/test/disassembler.js b/test/disassembler.js index 5e8e4013a9..d0c617f010 100644 --- a/test/disassembler.js +++ b/test/disassembler.js @@ -1,7 +1,7 @@ 'use strict' var tape = require('tape') -var disassemble = require('../babelify-src/code/disassembler').disassemble +var disassemble = require('../src/code/disassembler').disassemble tape('Disassembler', function (t) { t.test('empty', function (st) { diff --git a/test/eventManager.js b/test/eventManager.js index 0be53aa0a7..1e497504cf 100644 --- a/test/eventManager.js +++ b/test/eventManager.js @@ -1,6 +1,6 @@ 'use strict' var tape = require('tape') -var EventManager = require('../babelify-src/lib/eventManager') +var EventManager = require('../src/lib/eventManager') tape('eventManager', function (t) { t.test('eventManager', function (st) { var events = new EventManager() diff --git a/test/index.js b/test/index.js index c19d37e0c9..3dc4dc0e23 100644 --- a/test/index.js +++ b/test/index.js @@ -1,6 +1,6 @@ 'use strict' var tape = require('tape') -var init = require('../babelify-src/helpers/init') +var init = require('../src/helpers/init') tape('index', function (t) { t.test('loadContext - web3', function (st) { var web3 = init.loadWeb3() diff --git a/test/solidity/decodeInfo.js b/test/solidity/decodeInfo.js index 540cd57850..e2750784b2 100644 --- a/test/solidity/decodeInfo.js +++ b/test/solidity/decodeInfo.js @@ -1,7 +1,7 @@ 'use strict' var tape = require('tape') var compiler = require('solc') -var index = require('../../babelify-src/index') +var index = require('../../src/index') var contracts = require('./contracts/miscContracts') var simplecontracts = require('./contracts/simpleContract') diff --git a/test/solidity/localDecoder.js b/test/solidity/localDecoder.js index fa952d02d1..2830f676d0 100644 --- a/test/solidity/localDecoder.js +++ b/test/solidity/localDecoder.js @@ -6,8 +6,8 @@ var miscLocal = require('./contracts/miscLocal') var structArrayLocal = require('./contracts/structArrayLocal') var VM = require('ethereumjs-vm') var utileth = require('ethereumjs-util') -var Web3Providers = require('../../babelify-src/web3Provider/web3Providers') -var util = require('../../babelify-src/helpers/global') +var Web3Providers = require('../../src/web3Provider/web3Providers') +var util = require('../../src/helpers/global') var intLocalTest = require('./localsTests/int') var miscLocalTest = require('./localsTests/misc') var misc2LocalTest = require('./localsTests/misc2') diff --git a/test/solidity/localsTests/helper.js b/test/solidity/localsTests/helper.js index b27de0a7a6..1a03a7e009 100644 --- a/test/solidity/localsTests/helper.js +++ b/test/solidity/localsTests/helper.js @@ -1,5 +1,5 @@ 'use strict' -var localDecoder = require('../../../babelify-src/solidity/localDecoder') +var localDecoder = require('../../../src/solidity/localDecoder') /* Decode local variable diff --git a/test/solidity/localsTests/int.js b/test/solidity/localsTests/int.js index 6672667707..786f1a1c07 100644 --- a/test/solidity/localsTests/int.js +++ b/test/solidity/localsTests/int.js @@ -1,12 +1,12 @@ 'use strict' -var TraceManager = require('../../../babelify-src/trace/traceManager') -var CodeManager = require('../../../babelify-src/code/codeManager') +var TraceManager = require('../../../src/trace/traceManager') +var CodeManager = require('../../../src/code/codeManager') var vmSendTx = require('./vmCall') -var traceHelper = require('../../../babelify-src/helpers/traceHelper') -var util = require('../../../babelify-src/helpers/global') -var SolidityProxy = require('../../../babelify-src/solidity/solidityProxy') -var InternalCallTree = require('../../../babelify-src/util/internalCallTree') -var EventManager = require('../../../babelify-src/lib/eventManager') +var traceHelper = require('../../../src/helpers/traceHelper') +var util = require('../../../src/helpers/global') +var SolidityProxy = require('../../../src/solidity/solidityProxy') +var InternalCallTree = require('../../../src/util/internalCallTree') +var EventManager = require('../../../src/lib/eventManager') var helper = require('./helper') module.exports = function (st, vm, privateKey, contractBytecode, compilationResult, cb) { diff --git a/test/solidity/localsTests/misc.js b/test/solidity/localsTests/misc.js index 289e7c50d4..599b7493a6 100644 --- a/test/solidity/localsTests/misc.js +++ b/test/solidity/localsTests/misc.js @@ -1,12 +1,12 @@ 'use strict' -var TraceManager = require('../../../babelify-src/trace/traceManager') -var CodeManager = require('../../../babelify-src/code/codeManager') +var TraceManager = require('../../../src/trace/traceManager') +var CodeManager = require('../../../src/code/codeManager') var vmSendTx = require('./vmCall') -var traceHelper = require('../../../babelify-src/helpers/traceHelper') -var util = require('../../../babelify-src/helpers/global') -var SolidityProxy = require('../../../babelify-src/solidity/solidityProxy') -var InternalCallTree = require('../../../babelify-src/util/internalCallTree') -var EventManager = require('../../../babelify-src/lib/eventManager') +var traceHelper = require('../../../src/helpers/traceHelper') +var util = require('../../../src/helpers/global') +var SolidityProxy = require('../../../src/solidity/solidityProxy') +var InternalCallTree = require('../../../src/util/internalCallTree') +var EventManager = require('../../../src/lib/eventManager') var helper = require('./helper') module.exports = function (st, vm, privateKey, contractBytecode, compilationResult, cb) { diff --git a/test/solidity/localsTests/misc2.js b/test/solidity/localsTests/misc2.js index 4de758541d..9b9f6152f4 100644 --- a/test/solidity/localsTests/misc2.js +++ b/test/solidity/localsTests/misc2.js @@ -1,12 +1,12 @@ 'use strict' -var TraceManager = require('../../../babelify-src/trace/traceManager') -var CodeManager = require('../../../babelify-src/code/codeManager') +var TraceManager = require('../../../src/trace/traceManager') +var CodeManager = require('../../../src/code/codeManager') var vmSendTx = require('./vmCall') -var traceHelper = require('../../../babelify-src/helpers/traceHelper') -var util = require('../../../babelify-src/helpers/global') -var SolidityProxy = require('../../../babelify-src/solidity/solidityProxy') -var InternalCallTree = require('../../../babelify-src/util/internalCallTree') -var EventManager = require('../../../babelify-src/lib/eventManager') +var traceHelper = require('../../../src/helpers/traceHelper') +var util = require('../../../src/helpers/global') +var SolidityProxy = require('../../../src/solidity/solidityProxy') +var InternalCallTree = require('../../../src/util/internalCallTree') +var EventManager = require('../../../src/lib/eventManager') var helper = require('./helper') module.exports = function (st, vm, privateKey, contractBytecode, compilationResult, cb) { diff --git a/test/solidity/localsTests/structArray.js b/test/solidity/localsTests/structArray.js index 1070e48685..8d733ebd21 100644 --- a/test/solidity/localsTests/structArray.js +++ b/test/solidity/localsTests/structArray.js @@ -1,12 +1,12 @@ 'use strict' -var TraceManager = require('../../../babelify-src/trace/traceManager') -var CodeManager = require('../../../babelify-src/code/codeManager') +var TraceManager = require('../../../src/trace/traceManager') +var CodeManager = require('../../../src/code/codeManager') var vmSendTx = require('./vmCall') -var traceHelper = require('../../../babelify-src/helpers/traceHelper') -var util = require('../../../babelify-src/helpers/global') -var SolidityProxy = require('../../../babelify-src/solidity/solidityProxy') -var InternalCallTree = require('../../../babelify-src/util/internalCallTree') -var EventManager = require('../../../babelify-src/lib/eventManager') +var traceHelper = require('../../../src/helpers/traceHelper') +var util = require('../../../src/helpers/global') +var SolidityProxy = require('../../../src/solidity/solidityProxy') +var InternalCallTree = require('../../../src/util/internalCallTree') +var EventManager = require('../../../src/lib/eventManager') var helper = require('./helper') module.exports = function (st, vm, privateKey, contractBytecode, compilationResult, cb) { diff --git a/test/solidity/storageDecoder.js b/test/solidity/storageDecoder.js index 8b16cfda95..8abeb9fb31 100644 --- a/test/solidity/storageDecoder.js +++ b/test/solidity/storageDecoder.js @@ -1,7 +1,7 @@ 'use strict' var tape = require('tape') var compiler = require('solc') -var stateDecoder = require('../../babelify-src/index').solidity.stateDecoder +var stateDecoder = require('../../src/index').solidity.stateDecoder tape('solidity', function (t) { t.test('storage decoder', function (st) { diff --git a/test/solidity/storageLocation.js b/test/solidity/storageLocation.js index 8385ebe82b..a70fa5b93c 100644 --- a/test/solidity/storageLocation.js +++ b/test/solidity/storageLocation.js @@ -1,7 +1,7 @@ 'use strict' var tape = require('tape') var compiler = require('solc') -var index = require('../../babelify-src/index') +var index = require('../../src/index') var contracts = require('./contracts/miscContracts') tape('solidity', function (t) { diff --git a/test/sourceMappingDecoder.js b/test/sourceMappingDecoder.js index 6bbdfa3a7a..b1d5276897 100644 --- a/test/sourceMappingDecoder.js +++ b/test/sourceMappingDecoder.js @@ -1,6 +1,6 @@ 'use strict' var tape = require('tape') -var SourceMappingDecoder = require('../babelify-src/util/sourceMappingDecoder') +var SourceMappingDecoder = require('../src/util/sourceMappingDecoder') var compiler = require('solc') tape('SourceMappingDecoder', function (t) { diff --git a/test/traceManager.js b/test/traceManager.js index d35a4a5608..7ac63af98e 100644 --- a/test/traceManager.js +++ b/test/traceManager.js @@ -1,8 +1,8 @@ 'use strict' -var TraceManager = require('../babelify-src/trace/traceManager') +var TraceManager = require('../src/trace/traceManager') var tape = require('tape') -var Web3Providers = require('../babelify-src/web3Provider/web3Providers') -var util = require('../babelify-src/helpers/global') +var Web3Providers = require('../src/web3Provider/web3Providers') +var util = require('../src/helpers/global') var web3Test = require('./resources/testWeb3') tape('TraceManager', function (t) { diff --git a/test/util.js b/test/util.js index d8bbc65869..7113618e60 100644 --- a/test/util.js +++ b/test/util.js @@ -1,8 +1,8 @@ 'use strict' var sourceMapping = require('./resources/sourceMapping') -var index = require('../babelify-src/index') +var index = require('../src/index') var tape = require('tape') -var util = require('../babelify-src/helpers/util') +var util = require('../src/helpers/util') tape('Util', function (t) { t.test('lowerbound', function (st) {