hardhat-contract-sizer
Advanced tools
Comparing version
{ | ||
"name": "hardhat-contract-sizer", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Output Solidity contract sizes with Hardhat", |
@@ -47,1 +47,8 @@ # Hardhat Contract Sizer | ||
``` | ||
By default, the hardhat `compile` task is run before sizing contracts. You can disable | ||
this behavior by specifying `--no-compile` when you run the command: | ||
```bash | ||
yarn run hardhat size-contracts --compile false | ||
``` |
@@ -5,8 +5,11 @@ const { | ||
task(TASK_COMPILE, async function (args, hre, runSuper) { | ||
task(TASK_COMPILE).addFlag( | ||
'noSizeContracts', 'Don\'t size contracts after running this task, even if runOnCompile option is enabled' | ||
).setAction(async function (args, hre, runSuper) { | ||
await runSuper(); | ||
if (hre.config.contractSizer.runOnCompile) { | ||
await hre.run('size-contracts'); | ||
if (hre.config.contractSizer.runOnCompile && !args.noSizeContracts) { | ||
// Disable compile to avoid an infinite loop | ||
await hre.run('size-contracts', { noCompile: true }); | ||
} | ||
}); |
@@ -7,5 +7,13 @@ const colors = require('colors/safe'); | ||
task('size-contracts', 'Output the size of compiled contracts', async function (args, hre) { | ||
task('size-contracts', 'Output the size of compiled contracts') | ||
.addFlag('noCompile', 'Don\'t compile before running this task') | ||
.setAction(sizeContracts); | ||
async function sizeContracts(args, hre) { | ||
const config = hre.config.contractSizer; | ||
if (!args.noCompile) { | ||
await hre.run('compile', { noSizeContracts: true }); | ||
} | ||
const contracts = []; | ||
@@ -92,2 +100,2 @@ | ||
} | ||
}); | ||
} |
8189
8.45%191
4.95%54
14.89%