From 8c770a8b64ed611099b7e5bac8905226cadfad54 Mon Sep 17 00:00:00 2001 From: Dimitri Stallenberg Date: Fri, 22 Oct 2021 00:55:06 +0200 Subject: [PATCH 1/2] Repair the commands --- README.md | 2 +- docker/templates/truffle-config.js | 2 +- package.json | 3 ++- src/util/fileSystem.ts | 2 +- truffle-plugin.json | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d82c266..301b632 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ module.exports = { Next, you can run the following truffle command. ```bash -$ truffle run syntest-solidity [options] +$ truffle run @syntest/solidity [options] ``` ## Documentation diff --git a/docker/templates/truffle-config.js b/docker/templates/truffle-config.js index 71b45ef..09149d3 100644 --- a/docker/templates/truffle-config.js +++ b/docker/templates/truffle-config.js @@ -1,3 +1,3 @@ module.exports = { - plugins: ["syntest-solidity"], + plugins: ["@syntest/solidity"], }; diff --git a/package.json b/package.json index b0254b2..7a9b010 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@syntest/solidity", - "version": "0.1.0", + "version": "0.1.1", "description": "SynTest Solidity is a tool for automatically generating test cases for the Solidity platform", "keywords": [ "syntest", @@ -20,6 +20,7 @@ "types": "dist/index.d.ts", "files": [ "/dist", + "/src/**/*.js", "/api.js", "/NOTICE" ], diff --git a/src/util/fileSystem.ts b/src/util/fileSystem.ts index 3ee2ce2..41d1d17 100644 --- a/src/util/fileSystem.ts +++ b/src/util/fileSystem.ts @@ -65,7 +65,7 @@ export async function createTruffleConfig() { filepath, `module.exports = { test_directory: ".syntest/tests", - plugins: ["syntest-solidity"] + plugins: ["@syntest/solidity"] };` ); } diff --git a/truffle-plugin.json b/truffle-plugin.json index cb5d408..d0c0802 100644 --- a/truffle-plugin.json +++ b/truffle-plugin.json @@ -1,5 +1,5 @@ { "commands": { - "syntest-solidity": "truffle.plugin.js" + "@syntest/solidity": "truffle.plugin.js" } } From 9c4134faf0f3857f7d45e4bbd6128eec41cdfc3f Mon Sep 17 00:00:00 2001 From: Dimitri Stallenberg Date: Fri, 22 Oct 2021 16:40:30 +0200 Subject: [PATCH 2/2] Update --- package.json | 2 +- src/SolidityLauncher.ts | 26 ++++++++++++-------------- 2 files changed, 13 insertions(+), 15 deletions(-) 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", [