hardhat
hardhat copied to clipboard
Access default hardhat `compile` and `test` while still using this plugin
Is there some way to still access the native hardhat calls using this plugin?
I really like how this cleanly integrates into hardhat and replaces the compilation pipeline with forge and hardhat node with anvil as it gives a huge performance boost. And because it generates hardhat artifacts, all the hardhat scripts work well with foundry under the hood.
However, it would still be useful to do the default hardhat compile
from time to time to be able to generate typechain artifacts that I can pass to the front-end. And similarly, I can't seem to figure out a way to run the native hardhat tests, as hardhat test
only looks for forge tests.
Similarly, it seems if I try to run hardhat typechain
to just generate the types I need, that command is overriden by foundry and only attempts to compile the contract.
λ › npx hardhat typechain indie/contract dr-foundry
[⠒] Compiling...
No files changed, compilation skipped
One suggestion here might be to add a flag for compilation and testing. Something like npx hardhat compile --forge
instead of directly overwriting these commands. But I'm open to any solution or workaround you guys might have. @gakonst Using this plugin as opposed to the template because I saw your talk and I was really stoked about getting the performance benefits of foundry in Hardhat as we transition over :)
+1 one on this, if anyone has any workarounds this would be great. Looking to transition to forge as a drop in compiler for local dev while slowly migrating from hardhat to forge on-chain. However, the ability to use the default impl would be super helpful.
Edit:
one workaround to this is to use a separate config file for hardhat vs foundry where you only import @foundry-rs/hardhat-forge
in the foundry config :
yarn hardhat compile
yarn hardhat compile --config hardhat.config.forge.ts