foundry
foundry copied to clipboard
Compile solidity scripts
Component
Forge
Describe the feature you would like
Now that foundry supports scripting for deployments it would be trivial for the forge build
command to also compile solidity files found in the scripts folder.
Additional context
No response
I'm unsure what the use case for this is, given scripts are assumed to use cheatcodes which would not be deployable in a live environment. When you run a script it is built already. Can you expand on the use case?
Yes, you can classify this as nice to have it has no big inherent use case for most people. But when writing large deployments scripts for someone who might not be native to solidity is like doing it in a black box without knowing it the code compiles or doesn't.
Just to weigh in on this. One of the inherent advantages solidity scripting provides over using another language is the tight integration with the src/
contracts. This gives you type-safety (to the extend solidity can provide).
If we agree that ever commit should be compileable and not broken, then it is critical to ensure your scripts compile after any src/
change. Building scripts/
on forge build
will help eliminate drift and catch breaking changes earlier.