How to use the truffle/lib/contracts.compile function in truffle

To help you get started, we’ve selected a few truffle 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 ConsenSys / truffle-solidity-loader / index.js View on Github external
temp.mkdir('webpack-truffle', function(err, dirPath){
    if(!err) {
      var compilerOpts = {};
      compilerOpts.contracts_directory       = contractPath
      compilerOpts.contracts_build_directory = dirPath
      compilerOpts.network                   = buildOpts.network
      compilerOpts.network_id                = buildOpts.network_id
      compilerOpts.logger                    = Logger

      var provisionOpts = {}
      provisionOpts.provider                  = new Web3.providers.HttpProvider(buildOpts.web3_rpc_uri)
      provisionOpts.contracts_build_directory = dirPath

      TruffleContractCompiler.compile( compilerOpts, function(err, contracts){
        var migrationOpts = {}
        migrationOpts.migrations_directory      = buildOpts.migrations_directory
        migrationOpts.contracts_build_directory = dirPath
        migrationOpts.provider                  = provisionOpts.provider
        migrationOpts.network                   = compilerOpts.network
        migrationOpts.network_id                = compilerOpts.network_id
        migrationOpts.logger                    = Logger

        TruffleContractMigrator.run( migrationOpts, function( err, result ) {
          if(err) {
            Logger.error(err);
            return compilationFinished(err, null);
          }

          fs.readFile( path.resolve(dirPath, contractFileName+'.js'), 'utf8', function(err, solJsFile) {
            if(err) {

truffle

Truffle - Simple development framework for Ethereum

MIT
Latest version published 1 year ago

Package Health Score

55 / 100
Full package analysis