importfsfrom'fs'importpathfrom'path'import{task}from'hardhat/config'import{HardhatRuntimeEnvironment}from'hardhat/types'task('generate-deploy-config','generates a json config file for the current network').setAction(async({},hre:HardhatRuntimeEnvironment)=>{try{constbase=path.join(hre.config.paths.deployConfig,hre.network.name)if(fs.existsSync(`${base}.ts`)){// eslint-disable-next-line @typescript-eslint/no-var-requiresconstconfig=require(`${base}.ts`).defaultfs.writeFileSync(`${base}.json`,JSON.stringify(config,null,2),'utf8')}else{thrownewError('not found')}}catch(err){thrownewError(`error while loading deploy config for network: ${hre.network.name}, ${err}`)}})