hardhat-contract-sizer
Advanced tools
Comparing version
@@ -7,4 +7,5 @@ import 'hardhat/types/config'; | ||
alphaSort?: boolean, | ||
disambiguatePaths?: boolean, | ||
runOnCompile?: boolean, | ||
disambiguatePaths: boolean, | ||
strict?: boolean, | ||
} | ||
@@ -16,6 +17,7 @@ } | ||
alphaSort: boolean, | ||
disambiguatePaths: boolean, | ||
runOnCompile: boolean, | ||
disambiguatePaths: boolean, | ||
strict: boolean | ||
} | ||
} | ||
} |
16
index.js
@@ -5,2 +5,4 @@ const { extendConfig } = require('hardhat/config'); | ||
const { HardhatPluginError } = require('hardhat/plugins'); | ||
const { | ||
@@ -14,4 +16,5 @@ TASK_COMPILE, | ||
alphaSort: false, | ||
disambiguatePaths: false, | ||
runOnCompile: false, | ||
disambiguatePaths: false, | ||
strict: false, | ||
}, | ||
@@ -95,5 +98,12 @@ userConfig.contractSizer | ||
if (largeContracts) { | ||
if (largeContracts > 0) { | ||
console.log(); | ||
console.log(colors.red(`Warning: ${ largeContracts } contracts exceed the size limit for mainnet deployment.`)); | ||
const message = `Warning: ${ largeContracts } contracts exceed the size limit for mainnet deployment.`; | ||
if (hre.config.contractSizer.strict) { | ||
throw new HardhatPluginError(message); | ||
} else { | ||
console.log(colors.red(message)); | ||
} | ||
} | ||
@@ -100,0 +110,0 @@ }); |
{ | ||
"name": "hardhat-contract-sizer", | ||
"version": "2.0.3", | ||
"version": "2.1.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Output Solidity contract sizes with Hardhat", |
@@ -28,2 +28,3 @@ # Hardhat Contract Sizer | ||
| `disambiguatePaths` | whether to output the full path to the compilation artifact (relative to the Hardhat root directory) | `false` | | ||
| `strict` | whether to throw an error if any contracts exceed the size limit | `false` | | ||
@@ -33,4 +34,5 @@ ```javascript | ||
alphaSort: true, | ||
disambiguatePaths: false, | ||
runOnCompile: true, | ||
disambiguatePaths: false, | ||
strict: true, | ||
} | ||
@@ -37,0 +39,0 @@ ``` |
6913
5.78%173
5.49%44
4.76%