console.log('Hardhat artifacts folder doesn\'t exist... waiting for the first compilation.')
console.log('If you are using Hardhat, run `npx hardhat compile` or run the compilation with `Enable Hardhat Compilation` checked from the Remix IDE.')
this.listenOnHardHatFolder()
}
}
compile(configPath: string){
@ -67,7 +75,16 @@ export class HardhatClient extends PluginClient {
})
}
checkPath() {
if(!fs.existsSync(this.buildPath)){
this.listenOnHardHatFolder()
returnfalse
}
returntrue
}
privateasyncprocessArtifact() {
if(!this.checkPath())return
// resolving the files
constfolderFiles=awaitfs.readdir(this.buildPath)
consttargetsSynced=[]
@ -111,23 +128,32 @@ export class HardhatClient extends PluginClient {
}
}
}
if(!this.warnLog){
clearTimeout(this.logTimeout)
this.logTimeout=setTimeout(()=>{
this.call('terminal','log',{value:'receiving compilation result from Hardhat',type:'log'})
this.warnLog=true
}
if(targetsSynced.length){
console.log(`Processing artifacts for files: ${[...newSet(targetsSynced)].join(', ')}`)
// @ts-ignore
this.call('terminal','log',{type:'log',value:`synced with Hardhat: ${[...newSet(targetsSynced)].join(', ')}`})
}else{
console.log('No artifacts to process')
// @ts-ignore
this.call('terminal','log',{type:'log',value:'No artifacts from Hardhat to process'})
}
},1000)
}
listenOnHardHatFolder() {
console.log('Hardhat artifacts folder doesn\'t exist... waiting for the compilation.')