@@ -18,7 +18,7 @@ extendConfig((config) => {
1818
1919task ( TASK_COMPILE )
2020 . addFlag ( 'noTypechain' , 'Skip Typechain compilation' )
21- . setAction ( async ( { noTypechain } : { global : boolean ; noTypechain : boolean } , { config } , runSuper ) => {
21+ . setAction ( async ( { noTypechain } : { noTypechain : boolean } , { config } , runSuper ) => {
2222 // just save task arguments for later b/c there is no easier way to access them in subtask
2323 taskArgsStore . noTypechain = noTypechain ! ! || config . typechain . dontOverrideCompile
2424
@@ -28,14 +28,15 @@ task(TASK_COMPILE)
2828subtask ( TASK_COMPILE_SOLIDITY_COMPILE_JOBS , 'Compiles the entire project, building all artifacts' ) . setAction (
2929 async ( taskArgs , { run } , runSuper ) => {
3030 const compileSolOutput = await runSuper ( taskArgs )
31- await run ( TASK_TYPECHAIN_GENERATE_TYPES , { compileSolOutput } )
31+ await run ( TASK_TYPECHAIN_GENERATE_TYPES , { compileSolOutput, quiet : taskArgs . quiet } )
3232 return compileSolOutput
3333 } ,
3434)
3535
3636subtask ( TASK_TYPECHAIN_GENERATE_TYPES )
3737 . addParam ( 'compileSolOutput' , 'Solidity compilation output' , { } , types . any )
38- . setAction ( async ( { compileSolOutput } , { config, artifacts } ) => {
38+ . addFlag ( 'quiet' , 'Makes the process less verbose' )
39+ . setAction ( async ( { compileSolOutput, quiet } , { config, artifacts } ) => {
3940 const artifactFQNs : string [ ] = getFQNamesFromCompilationOutput ( compileSolOutput )
4041 const artifactPaths = uniq ( artifactFQNs . map ( ( fqn ) => artifacts . formArtifactPathFromFullyQualifiedName ( fqn ) ) )
4142
@@ -46,18 +47,23 @@ subtask(TASK_TYPECHAIN_GENERATE_TYPES)
4647 // RUN TYPECHAIN TASK
4748 const typechainCfg = config . typechain
4849 if ( artifactPaths . length === 0 && ! taskArgsStore . fullRebuild && ! typechainCfg . externalArtifacts ) {
49- // eslint-disable-next-line no-console
50- console . log ( 'No need to generate any newer typings.' )
50+ if ( ! quiet ) {
51+ // eslint-disable-next-line no-console
52+ console . log ( 'No need to generate any newer typings.' )
53+ }
54+
5155 return compileSolOutput
5256 }
5357
5458 // incremental generation is only supported in 'ethers-v5'
5559 // @todo : probably targets should specify somehow if then support incremental generation this won't work with custom targets
5660 const needsFullRebuild = taskArgsStore . fullRebuild || typechainCfg . target !== 'ethers-v5'
57- // eslint-disable-next-line no-console
58- console . log (
59- `Generating typings for: ${ artifactPaths . length } artifacts in dir: ${ typechainCfg . outDir } for target: ${ typechainCfg . target } ` ,
60- )
61+ if ( ! quiet ) {
62+ // eslint-disable-next-line no-console
63+ console . log (
64+ `Generating typings for: ${ artifactPaths . length } artifacts in dir: ${ typechainCfg . outDir } for target: ${ typechainCfg . target } ` ,
65+ )
66+ }
6167 const cwd = config . paths . root
6268
6369 const allFiles = glob ( cwd , [ `${ config . paths . artifacts } /!(build-info)/**/+([a-zA-Z0-9_]).json` ] )
@@ -82,16 +88,23 @@ subtask(TASK_TYPECHAIN_GENERATE_TYPES)
8288 ...typechainOptions ,
8389 filesToProcess : needsFullRebuild ? allFiles : glob ( cwd , artifactPaths ) , // only process changed files if not doing full rebuild
8490 } )
85- // eslint-disable-next-line no-console
86- console . log ( `Successfully generated ${ result . filesGenerated } typings!` )
91+
92+ if ( ! quiet ) {
93+ // eslint-disable-next-line no-console
94+ console . log ( `Successfully generated ${ result . filesGenerated } typings!` )
95+ }
96+
8797 // if this is not full rebuilding, always re-generate types for external artifacts
8898 if ( ! needsFullRebuild && typechainCfg . externalArtifacts ) {
8999 const result = await runTypeChain ( {
90100 ...typechainOptions ,
91101 filesToProcess : glob ( cwd , typechainCfg . externalArtifacts ! , false ) , // only process files with external artifacts
92102 } )
93- // eslint-disable-next-line no-console
94- console . log ( `Successfully generated ${ result . filesGenerated } typings for external artifacts!` )
103+
104+ if ( ! quiet ) {
105+ // eslint-disable-next-line no-console
106+ console . log ( `Successfully generated ${ result . filesGenerated } typings for external artifacts!` )
107+ }
95108 }
96109 } )
97110
0 commit comments