Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function setupDryRunEnvironmentThenRunMigrations(config) {
await Environment.fork(config);
// Copy artifacts to a temporary directory
const temporaryDirectory = temp.mkdirSync("migrate-dry-run-");
await promisifiedCopy(
config.contracts_build_directory,
temporaryDirectory
);
config.contracts_build_directory = temporaryDirectory;
// Note: Create a new artifactor and resolver with the updated config.
// This is because the contracts_build_directory changed.
// Ideally we could architect them to be reactive of the config changes.
config.artifactor = new Artifactor(temporaryDirectory);
config.resolver = new Resolver(config);
return await runMigrations(config);