How to use @truffle/workflow-compile - 6 common examples

To help you get started, we’ve selected a few @truffle/workflow-compile 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 / truffle-core / lib / commands / exec.js View on Github external
.then(() => {
        if (config.networkHint !== false) {
          config.logger.log("Using network '" + config.network + "'." + OS.EOL);
        }

        // `--compile`
        if (options.c || options.compile) {
          return Contracts.compile(config, function(err) {
            if (err) return done(err);

            Require.exec(
              config.with({
                file: file
              }),
              done
            );
          });
        }

        // Just exec
        Require.exec(
          config.with({
            file: file
          }),
github trufflesuite / truffle / packages / truffle-core / lib / commands / opcode.js View on Github external
run: function(options, done) {
    var Config = require("truffle-config");
    var TruffleError = require("@truffle/error");
    var Contracts = require("@truffle/workflow-compile");
    var CodeUtils = require("@truffle/code-utils");

    if (options._.length === 0) {
      return done(new TruffleError("Please specify a contract name."));
    }

    var config = Config.detect(options);
    Contracts.compile(config, function(err) {
      if (err) return done(err);

      var contractName = options._[0];
      var Contract;
      try {
        Contract = config.resolver.require(contractName);
      } catch (e) {
        return done(
          new TruffleError(
            'Cannot find compiled contract with name "' + contractName + '"'
          )
        );
      }

      var bytecode = Contract.deployedBytecode;
      var numInstructions = Contract.deployedSourceMap.split(";").length;
github trufflesuite / truffle / packages / truffle-core / lib / commands / migrate.js View on Github external
run: function(options, done) {
    const Artifactor = require("truffle-artifactor");
    const Resolver = require("truffle-resolver");
    const Migrate = require("truffle-migrate");
    const Contracts = require("@truffle/workflow-compile");
    const { Environment } = require("truffle-environment");
    const Config = require("truffle-config");
    const temp = require("temp").track();
    const { promisify } = require("util");
    const promisifiedCopy = promisify(require("../copy"));

    const conf = Config.detect(options);

    Contracts.compile(conf)
      .then(async () => {
        await Environment.detect(conf);
        const {
          dryRunOnly,
          dryRunAndMigrations
        } = command.determineDryRunSettings(conf, options);

        if (dryRunOnly) {
          conf.dryRun = true;
          await setupDryRunEnvironmentThenRunMigrations(conf);
        } else if (dryRunAndMigrations) {
          const currentBuild = conf.contracts_build_directory;
          conf.dryRun = true;

          await setupDryRunEnvironmentThenRunMigrations(conf);
github trufflesuite / truffle / packages / core / lib / commands / migrate.js View on Github external
run: function(options, done) {
    const Artifactor = require("@truffle/artifactor");
    const Resolver = require("@truffle/resolver");
    const Migrate = require("@truffle/migrate");
    const Contracts = require("@truffle/workflow-compile");
    const Provider = require("@truffle/provider");
    const { Environment } = require("@truffle/environment");
    const Config = require("@truffle/config");
    const temp = require("temp").track();
    const { promisify } = require("util");
    const promisifiedCopy = promisify(require("../copy"));

    const conf = Config.detect(options);

    Contracts.compile(conf)
      .then(async () => {
        await Provider.testConnection(conf);
        await Environment.detect(conf);

        const {
          dryRunOnly,
          dryRunAndMigrations
        } = command.determineDryRunSettings(conf, options);

        if (dryRunOnly) {
          conf.dryRun = true;
          await setupDryRunEnvironmentThenRunMigrations(conf);
        } else if (dryRunAndMigrations) {
          const currentBuild = conf.contracts_build_directory;
          conf.dryRun = true;
github trufflesuite / truffle / packages / truffle-core / lib / commands / compile.js View on Github external
run: function(options, done) {
    const Contracts = require("@truffle/workflow-compile");
    const Config = require("truffle-config");
    const config = Config.detect(options);

    if (config.list !== undefined) {
      command
        .listVersions(config)
        .then(() => done())
        .catch(done);
    } else {
      Contracts.compile(config)
        .then(() => done())
        .catch(done);
    }
  },
  listVersions: async function(options) {
github trufflesuite / truffle / packages / truffle-db / src / loaders / artifacts / index.ts View on Github external
async loadCompilation(compilationConfig: CompilationConfigObject) {
    const compilationOutput = await Contracts.compile(compilationConfig);
    const contracts = compilationOutput.compilations;

    const compilationObjects = await Promise.all(
      Object.values(contracts)
        .filter(contracts => contracts["contracts"].length > 0)
        .map(({ contracts }) => {
          return this.setCompilation(contracts);
        })
    );

    const compilations = await this.db.query(AddCompilation, {
      compilations: compilationObjects
    });

    return { compilations, contracts };
  }

@truffle/workflow-compile

Core workflow behavior for `truffle compile` command

MIT
Latest version published 1 year ago

Package Health Score

50 / 100
Full package analysis

Similar packages