How to use the @truffle/environment.Environment.fork function in @truffle/environment

To help you get started, we’ve selected a few @truffle/environment examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trufflesuite / truffle / packages / core / lib / commands / migrate.js View on Github external
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);

@truffle/environment

This package contains the code needed to determine environment-specific data

MIT
Latest version published 8 months ago

Package Health Score

50 / 100
Full package analysis

Similar packages