diff options
Diffstat (limited to 'packages/sol-compiler')
-rw-r--r-- | packages/sol-compiler/README.md | 8 | ||||
-rw-r--r-- | packages/sol-compiler/package.json | 3 | ||||
-rw-r--r-- | packages/sol-compiler/src/utils/compiler.ts | 7 |
3 files changed, 13 insertions, 5 deletions
diff --git a/packages/sol-compiler/README.md b/packages/sol-compiler/README.md index 76d0e9b8b..3a6ca130b 100644 --- a/packages/sol-compiler/README.md +++ b/packages/sol-compiler/README.md @@ -1,6 +1,12 @@ ## @0xproject/sol-compiler -This repository contains a CLI tool that facilitates compiling smart contracts. +Sol-compiler is a wrapper around [solc-js](https://www.npmjs.com/package/solc) that adds: + +* Smart re-compilation: Only recompiles when smart contracts have changed +* Ability to compile an entire project instead of only individual `.sol` files +* Compilation using the Solidity version specified at the top of each individual `.sol` file +* Proper parsing of Solidity version ranges +* Support for the standard [input description](https://solidity.readthedocs.io/en/develop/using-the-compiler.html#input-description) for what information you'd like added to the resulting `artifacts` file (i.e 100% configurable artifacts content). ### Read the [Documentation](https://0xproject.com/docs/sol-compiler). diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index 98568c270..d5a2e6e77 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -84,7 +84,7 @@ "@0xproject/utils": "^0.7.1", "@0xproject/web3-wrapper": "^0.7.1", "@types/yargs": "^11.0.0", - "ethereum-types": "^0.0.1", + "ethereum-types": "^0.0.2", "chalk": "^2.3.0", "ethereumjs-util": "^5.1.1", "isomorphic-fetch": "^2.2.1", @@ -93,7 +93,6 @@ "require-from-string": "^2.0.1", "semver": "^5.5.0", "solc": "^0.4.23", - "web3": "^0.20.0", "web3-eth-abi": "^1.0.0-beta.24", "yargs": "^10.0.3" }, diff --git a/packages/sol-compiler/src/utils/compiler.ts b/packages/sol-compiler/src/utils/compiler.ts index 08e2d999a..968fcc5b2 100644 --- a/packages/sol-compiler/src/utils/compiler.ts +++ b/packages/sol-compiler/src/utils/compiler.ts @@ -58,7 +58,8 @@ export function parseSolidityVersionRange(source: string): string { } /** - * Normalizes the path found in the error message. + * Normalizes the path found in the error message. If it cannot be normalized + * the original error message is returned. * Example: converts 'base/Token.sol:6:46: Warning: Unused local variable' * to 'Token.sol:6:46: Warning: Unused local variable' * This is used to prevent logging the same error multiple times. @@ -69,7 +70,9 @@ export function getNormalizedErrMsg(errMsg: string): string { const SOLIDITY_FILE_EXTENSION_REGEX = /(.*\.sol)/; const errPathMatch = errMsg.match(SOLIDITY_FILE_EXTENSION_REGEX); if (_.isNull(errPathMatch)) { - throw new Error(`Could not find a path in error message: ${errMsg}`); + // This can occur if solidity outputs a general warning, e.g + // Warning: This is a pre-release compiler version, please do not use it in production. + return errMsg; } const errPath = errPathMatch[0]; const baseContract = path.basename(errPath); |