trufflesuite / truffle-migrate

On-chain migrations management
17 stars 17 forks source link

Add promises support in migrations #30

Open Jabher opened 6 years ago

Jabher commented 6 years ago

Motivation: sometimes some async actions should be performed within migration (e.g. fetch remote server to get contract creation arguments); right now it is impossible (at least without some complicated and not user-friendly tricks). With this fix syntax like

module.exports = async (deployer) => {
  const args = await fetchArgs();
  deployer.deploy(contract, ...args);
}

becomes available.