From 5e20f27c99171210d56a16e68b486cc62f2cf9da Mon Sep 17 00:00:00 2001 From: emizzle Date: Thu, 14 Jun 2018 18:09:02 +1000 Subject: [PATCH] Solc loading issue now fully resolved Added better error checking for solidity compilation errors Extracted timer functionality for downloading packages so it works across the main process and child processes. Npm class is instantiated only once and reused for event commands. Npm class can handle concurrent requests for the same package and callback the installation result for each request. --- .vscode/launch.json | 147 ++++++++++++++++++++++++++++++++ lib/modules/solidity/solcP.js | 2 +- lib/modules/solidity/solcW.js | 2 - lib/versions/library_manager.js | 2 +- package.json | 1 - 5 files changed, 149 insertions(+), 5 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..b77f5b056 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,147 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + { + "type": "node", + "request": "launch", + "name": "Embark: Mocha All", + "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", + "args": [ + "--colors", + "--no-timeouts", + "${workspaceFolder}/test/" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Embark: Mocha Current File", + "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", + "args": [ + "--colors", + "--no-timeouts", + "${file}" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Embark: embark test", + "autoAttachChildProcesses": true, + //"preLaunchTask": "npm_install", + "program": "${workspaceFolder}/lib/tests/test_embark", + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Test app: Embark test", + "cwd": "${workspaceFolder}/test_apps/test_app/", + "autoAttachChildProcesses": true, + //"preLaunchTask": "npm_install", + "program": "${workspaceFolder}/bin/embark", + "args": [ + "test" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Test app: Embark new testapp123", + "cwd": "${workspaceFolder}/test_apps/test_app/", + "autoAttachChildProcesses": true, + //"preLaunchTask": "npm_install", + "program": "${workspaceFolder}/bin/embark", + "args": [ + "new", + "testapp123" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Test app: Embark upload", + "cwd": "${workspaceFolder}/test_apps/test_app/", + "autoAttachChildProcesses": true, + //"preLaunchTask": "npm_install", + "program": "${workspaceFolder}/bin/embark", + "args": [ + "upload" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Test app: Embark run", + "cwd": "${workspaceFolder}/test_apps/test_app/", + "autoAttachChildProcesses": true, + //"preLaunchTask": "npm_install", + "program": "${workspaceFolder}/bin/embark", + "args": [ + "run", + "--nodashboard" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Embark demo from main repo: Embark run", + "cwd": "${workspaceFolder}/../../embk-fw/embark/embark_demo/", + "autoAttachChildProcesses": true, + //"preLaunchTask": "npm_install", + "program": "${workspaceFolder}/bin/embark", + "args": [ + "run" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Embark demo from dapp-bin: Embark run", + "cwd": "${workspaceFolder}/../../embk-fw/dapp-bin/embark_demo/", + "autoAttachChildProcesses": false, + //"preLaunchTask": "npm_install", + "program": "${workspaceFolder}/bin/embark", + "args": [ + "run", + "--nodashboard" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Embark react routes demo: Embark run", + "cwd": "${workspaceFolder}/../../emizzle/embark-demo-react-routes/", + "autoAttachChildProcesses": true, + //"preLaunchTask": "npm_install", + "program": "${workspaceFolder}/bin/embark", + "args": [ + "run" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + } + + ] +} \ No newline at end of file diff --git a/lib/modules/solidity/solcP.js b/lib/modules/solidity/solcP.js index 07ee017e9..060c9ae1a 100644 --- a/lib/modules/solidity/solcP.js +++ b/lib/modules/solidity/solcP.js @@ -68,7 +68,7 @@ let solcProcess; process.on('message', (msg) => { if (msg.action === "init") { solcProcess = new SolcProcess(msg.options); - return this.send({result: "initiated"}); + return process.send({result: "initiated"}); } else if (msg.action === 'loadCompiler') { diff --git a/lib/modules/solidity/solcW.js b/lib/modules/solidity/solcW.js index e180844d3..bc5df52ea 100644 --- a/lib/modules/solidity/solcW.js +++ b/lib/modules/solidity/solcW.js @@ -62,8 +62,6 @@ class SolcW { }); this.solcProcess.send({action: "init", options: {logger: self.logger}}); - this.solcProcess.send({action: "init", options: {}}); - if (this.ipc.isServer()) { this.ipc.on('compile', self.compile.bind(this)); } diff --git a/lib/versions/library_manager.js b/lib/versions/library_manager.js index d65d5e262..b5cc3d8a5 100644 --- a/lib/versions/library_manager.js +++ b/lib/versions/library_manager.js @@ -64,8 +64,8 @@ class LibraryManager { } listenToCommandsToGetLibrary() { + let npm = new Npm({logger: this.embark.logger}); this.embark.events.setCommandHandler('version:getPackageLocation', (libName, version, cb) => { - let npm = new Npm({logger: this.embark.logger, packageName: libName, version:version}); npm.getPackageVersion(libName, version, cb); }); this.embark.events.setCommandHandler('version:getPackagePath', (libName, version, cb) => { diff --git a/package.json b/package.json index fe4aba71f..901bcee8a 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "babel-preset-es2017": "6.24.1", "babel-preset-react": "^6.24.1", "bip39": "^2.5.0", - "neo-blessed": "^0.2.0", "chokidar": "^2.0.3", "clone-deep": "^4.0.0", "colors": "^1.1.2",