wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.17k stars 283 forks source link

add dependencyOnlyDeploy for external contracts config #492

Open nataouze opened 8 months ago

nataouze commented 8 months ago

Fixes #341 and #342

Adds an optional execute field in the external.contracts configuration which indicates whether the external.contracts.deploy scripts should be executed (defaults to true for retrocompatibilty). If set to false, the external deploy scripts are not executed by default but can be used as tag-based dependencies when running the main (non-external) deploy scripts.

DeploymentsManager.executeDeployScripts signature is changed to accept the parameters scriptPathBags and funcByFilePath as it does not load the deployment tags and functions before execution anymore: DeploymentsManager.loadDeployScripts must be run first to generate these arguments.

nataouze commented 8 months ago

Finally changed the implementation to make it less intrusive: DeploymentsManager.executeDeployScripts is back to what it was and does not require to run DeploymentsManager.loadDeployScripts first. The external non-execute deploy scripts are loaded in DeploymentsManager.db.dependenciesScriptPathBags and DeploymentsManager.db.dependenciesFuncByFilePath fields instead which are used in DeploymentsManager.executeDeployScripts as fallback if tags or scripts are not found from the main scripts folders.

@wighawag it would be great if you could take a look at this

lucastAB commented 7 months ago

Oh man, this is helpful.

miroslavchmelka commented 7 months ago

i was looking for this feature, will it be merged?

mdguo commented 7 months ago

+1

tbinetruy commented 4 months ago

+1