diff --git a/package.json b/package.json index 7a9b010..e75ba66 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "pify": "^4.0.1", "recursive-readdir": "^2.2.2", "sc-istanbul": "^0.4.5", - "shelljs": "^0.8.3", + "semver": "^7.3.5", "solidity-coverage": "^0.7.16", "truffle": "^5.1.65", "web3": "^1.3.4", diff --git a/src/SolidityLauncher.ts b/src/SolidityLauncher.ts index a9ec779..eb429bc 100644 --- a/src/SolidityLauncher.ts +++ b/src/SolidityLauncher.ts @@ -152,7 +152,10 @@ export class SolidityLauncher { const additionalOptions = {}; // TODO setupOptions(this._program, additionalOptions); - const args = process.argv.slice(process.argv.indexOf(this._program) + 1); + const index = process.argv.indexOf(process.argv.find((a) => a.includes(this._program))) + + const args = process.argv.slice(index + 1); + const myConfig = loadConfig(args); processConfig(myConfig, args); @@ -187,14 +190,14 @@ export class SolidityLauncher { getUserInterface().report("asciiArt", ["Syntest"]); getUserInterface().report("version", [require("../package.json").version]); - if (this.config.help) { + this.truffle = loadLibrary(this.config); + this.api = new API(myConfig); + + if (args.includes("--help") || args.includes("-h")) { getUserInterface().report("help", []); await this.exit(); } // Exit if --help - this.truffle = loadLibrary(this.config); - this.api = new API(myConfig); - setNetwork(this.config, this.api); // Server launch @@ -206,24 +209,19 @@ export class SolidityLauncher { const nodeInfo = await web3.eth.getNodeInfo(); const ganacheVersion = nodeInfo.split("/")[1]; - setNetworkFrom(this.config, accounts); - // Exit if --version - if (this.config.version) { + if (args.includes("--version") || args.includes("-v")) { getUserInterface().report("versions", [ this.truffle.version, ganacheVersion, pkg.version, - ]); // Exit if --help - - // Finish - await tearDownTempFolders(this.tempContractsDir, this.tempArtifactsDir); + ]); - // Shut server down - await this.api.finish(); await this.exit(); } + setNetworkFrom(this.config, accounts); + getUserInterface().report("header", ["GENERAL INFO"]); getUserInterface().report("property-set", [