2016-09-25 01:23:57 +00:00
|
|
|
/*jshint esversion: 6, loopfunc: true */
|
2017-03-29 17:50:05 +00:00
|
|
|
let fs = require('../core/fs.js');
|
2017-07-05 12:35:51 +00:00
|
|
|
let async = require('async');
|
2017-12-12 17:20:57 +00:00
|
|
|
var Plugins = require('../core/plugins.js');
|
|
|
|
var utils = require('../utils/utils.js');
|
|
|
|
var Npm = require('../pipeline/npm.js');
|
|
|
|
let currentWeb3Version = require('../../package.json').dependencies.web3.replace("^","");
|
|
|
|
const webpack = require("webpack");
|
2016-08-21 16:02:02 +00:00
|
|
|
|
2017-03-30 11:12:39 +00:00
|
|
|
class Pipeline {
|
2017-01-15 19:30:41 +00:00
|
|
|
|
2017-03-30 11:12:39 +00:00
|
|
|
constructor(options) {
|
|
|
|
this.buildDir = options.buildDir;
|
|
|
|
this.contractsFiles = options.contractsFiles;
|
|
|
|
this.assetFiles = options.assetFiles;
|
2017-12-12 17:20:57 +00:00
|
|
|
this.events = options.events;
|
2017-03-30 11:12:39 +00:00
|
|
|
this.logger = options.logger;
|
|
|
|
this.plugins = options.plugins;
|
|
|
|
}
|
2017-01-15 19:30:41 +00:00
|
|
|
|
2017-07-05 12:35:51 +00:00
|
|
|
build(abi, contractsJSON, path, callback) {
|
2017-03-30 11:12:39 +00:00
|
|
|
let self = this;
|
2017-06-27 22:18:29 +00:00
|
|
|
|
|
|
|
this.buildContracts(contractsJSON);
|
|
|
|
|
2017-07-05 12:35:51 +00:00
|
|
|
// limit:1 due to issues when downloading required files such as web3.js
|
|
|
|
async.eachOfLimit(this.assetFiles, 1, function (files, targetFile, cb) {
|
2017-12-12 17:20:57 +00:00
|
|
|
// limit:1 due to issues when downloading required files such as web3.js
|
|
|
|
async.mapLimit(files, 1,
|
|
|
|
function(file, fileCb) {
|
|
|
|
self.logger.trace("reading " + file.filename);
|
|
|
|
|
|
|
|
if (file.filename.indexOf('.js') >= 0) {
|
2017-12-12 19:37:47 +00:00
|
|
|
let importsList = {};
|
2017-12-12 17:20:57 +00:00
|
|
|
|
2017-12-12 19:37:47 +00:00
|
|
|
importsList["Embark/EmbarkJS"] = fs.embarkPath("js/embark.js");
|
2017-12-12 17:20:57 +00:00
|
|
|
|
|
|
|
async.waterfall([
|
|
|
|
function findImports(next) {
|
|
|
|
webpack({
|
|
|
|
entry: utils.joinPath(fs.dappPath(), file.filename),
|
|
|
|
output: {
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
path: utils.joinPath(fs.dappPath(), '.embark'),
|
|
|
|
filename: file.filename
|
|
|
|
},
|
|
|
|
externals: function(context, request, callback) {
|
|
|
|
if (request === utils.joinPath(fs.dappPath(), file.filename)) {
|
|
|
|
callback();
|
|
|
|
} else {
|
|
|
|
console.log("request " + request);
|
2017-12-12 19:37:47 +00:00
|
|
|
if (request.indexOf('Embark/contracts/') === 0) {
|
2017-12-12 17:20:57 +00:00
|
|
|
let contractName = request.split('/')[2];
|
|
|
|
let contractCode = self.buildContractJS(contractName);
|
|
|
|
let filePath = utils.joinPath(fs.dappPath(), ".embark", contractName + '.js');
|
|
|
|
fs.writeFileSync(filePath, contractCode);
|
|
|
|
importsList[request] = filePath;
|
|
|
|
} else if (request === "Embark/web3") {
|
|
|
|
console.log("--> web3");
|
|
|
|
return self.events.request('provider-code', function(providerCode) {
|
|
|
|
let code = "";
|
|
|
|
code += "\nimport Web3 from '" + utils.joinPath(fs.embarkPath("js/web3-1.0.min.js")) + "'\n";
|
|
|
|
//code += "\nvar __mainContext = __mainContext || this;\n";
|
|
|
|
|
|
|
|
code += "\n if (typeof web3 !== 'undefined') {";
|
|
|
|
//code += "\n__mainContext.web3 = web3;\n";
|
|
|
|
code += "\n } else {";
|
|
|
|
code += "\n var web3 = new Web3();\n";
|
|
|
|
code += "\n }";
|
|
|
|
|
|
|
|
code += providerCode;
|
|
|
|
code += "\nglobal.__embarkContext = __mainContext.__loadManagerInstance;\n";
|
|
|
|
code += "\nconsole.log('web3');\n";
|
|
|
|
code += "\nconsole.log(web3);\n";
|
|
|
|
//code += "\nwindow.web3 = __mainContext.web3;\n";
|
|
|
|
code += "\nwindow.web3 = web3;\n";
|
|
|
|
code += "\nexport default web3;\n";
|
|
|
|
let filePath = utils.joinPath(fs.dappPath(), ".embark", 'web3_instance.js');
|
|
|
|
fs.writeFileSync(filePath, code);
|
|
|
|
importsList[request] = filePath;
|
|
|
|
callback(null, "amd " + Math.random());
|
|
|
|
});
|
|
|
|
}
|
|
|
|
callback(null, "amd " + Math.random());
|
|
|
|
}
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
{ loader: "style-loader" },
|
|
|
|
{ loader: "css-loader" }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}).run((err, stats) => {
|
|
|
|
next();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
function runWebpack(next) {
|
|
|
|
webpack({
|
|
|
|
entry: utils.joinPath(fs.dappPath(), file.filename),
|
|
|
|
output: {
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
path: utils.joinPath(fs.dappPath(), '.embark'),
|
|
|
|
filename: file.filename
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
alias: importsList
|
|
|
|
},
|
|
|
|
externals: function(context, request, callback) {
|
|
|
|
if (request === "Embark/contracts/all") {
|
|
|
|
return callback(null, fs.readFileSync(utils.joinPath(fs.dappPath(), '.embark', 'embark.js')));
|
|
|
|
}
|
|
|
|
callback();
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
{ loader: "style-loader" },
|
|
|
|
{ loader: "css-loader" }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}).run((err, stats) => {
|
|
|
|
next();
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
], function(err, _result) {
|
|
|
|
let fileContent = fs.readFileSync('./.embark/' + file.filename).toString();
|
|
|
|
fileCb(null, {content: fileContent, filename: file.filename, path: file.path, modified: true});
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
file.content(function(fileContent) {
|
|
|
|
return fileCb(null, {content: fileContent, filename: file.filename, path: file.path, modified: true});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
function (err, contentFiles) {
|
|
|
|
let dir = targetFile.split('/').slice(0, -1).join('/');
|
|
|
|
self.logger.trace("creating dir " + self.buildDir + dir);
|
|
|
|
fs.mkdirpSync(self.buildDir + dir);
|
|
|
|
|
|
|
|
// if it's a directory
|
|
|
|
if (targetFile.slice(-1) === '/' || targetFile.indexOf('.') === -1) {
|
|
|
|
let targetDir = targetFile;
|
|
|
|
|
|
|
|
if (targetDir.slice(-1) !== '/') {
|
|
|
|
targetDir = targetDir + '/';
|
|
|
|
}
|
|
|
|
|
|
|
|
contentFiles.map(function (file) {
|
|
|
|
let filename = file.filename.replace('app/', '');
|
|
|
|
filename = filename.replace(targetDir, '');
|
|
|
|
self.logger.info("writing file " + (self.buildDir + targetDir + filename).bold.dim);
|
2017-01-29 05:58:06 +00:00
|
|
|
|
2017-12-12 17:20:57 +00:00
|
|
|
fs.copySync(self.buildDir + targetDir + filename, file.path, {overwrite: true});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
let content = contentFiles.map(function (file) {
|
|
|
|
if (file === undefined) {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
return file.content;
|
|
|
|
}).join("\n");
|
|
|
|
|
|
|
|
self.logger.info("writing file " + (self.buildDir + targetFile).bold.dim);
|
|
|
|
fs.writeFileSync(self.buildDir + targetFile, content);
|
|
|
|
}
|
|
|
|
cb();
|
|
|
|
}
|
|
|
|
);
|
|
|
|
},
|
|
|
|
function (_err, _results) {
|
|
|
|
callback();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
build2(abi, contractsJSON, path, callback) {
|
|
|
|
let self = this;
|
|
|
|
|
|
|
|
this.buildContracts(contractsJSON);
|
|
|
|
|
|
|
|
// limit:1 due to issues when downloading required files such as web3.js
|
|
|
|
async.eachOfLimit(this.assetFiles, 1, function (files, targetFile, cb) {
|
2017-07-05 12:35:51 +00:00
|
|
|
// limit:1 due to issues when downloading required files such as web3.js
|
|
|
|
async.mapLimit(files, 1,
|
|
|
|
function(file, fileCb) {
|
|
|
|
self.logger.trace("reading " + file.filename);
|
2017-01-29 05:58:06 +00:00
|
|
|
|
2017-07-05 12:35:51 +00:00
|
|
|
let pipelinePlugins = self.plugins.getPluginsFor('pipeline');
|
2017-03-30 11:12:39 +00:00
|
|
|
|
2017-07-05 12:35:51 +00:00
|
|
|
if (file.filename === "$ALL_CONTRACTS") {
|
|
|
|
return fileCb(null, {content: abi, filename: file.filename, path: file.path, modified: true});
|
|
|
|
} else if (file.filename === "$EMBARK_JS") {
|
|
|
|
return file.content(function(fileContent) {
|
|
|
|
return fileCb(null, {content: fileContent, filename: "embark.js", path: file.path, modified: true});
|
|
|
|
});
|
|
|
|
} else if (file.filename[0] === '$') {
|
|
|
|
let contractName = file.filename.substr(1);
|
|
|
|
return fileCb(null, {content: self.buildContractJS(contractName), filename: contractName + ".js", path: file.path, modified: true});
|
|
|
|
} else if (file.filename === 'embark.js') {
|
2017-12-12 17:20:57 +00:00
|
|
|
|
|
|
|
//if (file === 'embark.js') {
|
|
|
|
//
|
|
|
|
// if (self.blockchainConfig.enabled || self.communicationConfig.provider === 'whisper' || self.communicationConfig.available_providers.indexOf('whisper') >= 0) {
|
|
|
|
// let web3Version = self.contractsConfig.versions["web3.js"];
|
|
|
|
// if (web3Version && web3Version != currentWeb3Version) {
|
|
|
|
// //if (false) {
|
|
|
|
// //readFiles.push(new File({filename: 'web3-' + web3Version + '.js', type: 'custom', resolver: function(callback) {
|
|
|
|
// readFiles.push(new File({filename: 'web3.js', type: 'custom', resolver: function(callback) {
|
|
|
|
// if (web3Version === "1.0.0-beta") {
|
|
|
|
// return callback(fs.readFileSync(fs.embarkPath('js/web3-1.0.min.js')).toString());
|
|
|
|
// } else {
|
|
|
|
// let npm = new Npm({logger: self.logger});
|
|
|
|
// npm.getPackageVersion('web3', web3Version, 'dist/web3.min.js', true, function(web3Content) {
|
|
|
|
// callback(web3Content);
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// }}));
|
|
|
|
// } else {
|
|
|
|
// readFiles.push(new File({filename: 'web3.js', type: 'embark_internal', path: "js/web3.js"}));
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// if (self.storageConfig.enabled && (self.storageConfig.provider === 'ipfs' || self.storageConfig.available_providers.indexOf('ipfs') >= 0)) {
|
|
|
|
// //until issues with the correct ipfs version to use are fixed
|
|
|
|
// //readFiles.push(new File({filename: 'ipfs.js', type: 'embark_internal', path: "node_modules/ipfs-api/dist/index.min.js"}));
|
|
|
|
// readFiles.push(new File({filename: 'ipfs.js', type: 'embark_internal', path: "js/ipfs.js"}));
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// if (self.communicationConfig.enabled && (self.communicationConfig.provider === 'orbit' || self.communicationConfig.available_providers.indexOf('orbit') >= 0)) {
|
|
|
|
// readFiles.push(new File({filename: 'orbit.js', type: 'embark_internal', path: "node_modules/orbit-db/dist/orbitdb.min.js"}));
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// readFiles.push(new File({filename: 'embark.js', type: 'embark_internal', path: "js/build/embark.bundle.js"}));
|
|
|
|
//}
|
|
|
|
|
2017-07-05 12:35:51 +00:00
|
|
|
return file.content(function(fileContent) {
|
|
|
|
return fileCb(null, {content: fileContent + "\n" + abi, filename: file.filename, path: file.path, modified: true});
|
|
|
|
});
|
2017-12-12 17:20:57 +00:00
|
|
|
|
|
|
|
|
2017-07-05 12:35:51 +00:00
|
|
|
} else if (file.filename === 'abi.js') {
|
|
|
|
return fileCb(null, {content: abi, filename: file.filename, path: file.path, modified: true});
|
|
|
|
} else if (['web3.js', 'ipfs.js', 'ipfs-api.js', 'orbit.js'].indexOf(file.filename) >= 0) {
|
|
|
|
file.content(function(fileContent) {
|
|
|
|
return fileCb(null, {content: fileContent, filename: file.filename, path: file.path, modified: true});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (pipelinePlugins.length > 0) {
|
|
|
|
file.content(function(fileContent) {
|
|
|
|
async.eachSeries(pipelinePlugins, function(plugin, pluginCB) {
|
|
|
|
if (file.options && file.options.skipPipeline) {
|
|
|
|
return pluginCB();
|
|
|
|
}
|
|
|
|
|
|
|
|
fileContent = plugin.runPipeline({targetFile: file.filename, source: fileContent});
|
|
|
|
file.modified = true;
|
|
|
|
pluginCB();
|
|
|
|
},
|
|
|
|
function (err) {
|
|
|
|
if (err) {
|
|
|
|
self.logger.error(err.message);
|
|
|
|
}
|
|
|
|
return fileCb(null, {content: fileContent, filename: file.filename, path: file.path, modified: true});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
file.content(function(fileContent) {
|
|
|
|
return fileCb(null, {content: fileContent, filename: file.filename, path: file.path, modified: true});
|
|
|
|
});
|
|
|
|
}
|
2017-12-12 17:20:57 +00:00
|
|
|
|
|
|
|
//if (file.indexOf('.js') >= 0) {
|
|
|
|
////if (file.indexOf('.js') >= 0) {
|
|
|
|
// readFiles.push(new File({filename: file, type: "custom", path: file, resolver: function(fileCallback) {
|
|
|
|
// console.log("---");
|
|
|
|
// console.log(fs.dappPath());
|
|
|
|
// console.log(file);
|
|
|
|
// console.log("---");
|
|
|
|
//
|
|
|
|
// let importsList = {};
|
|
|
|
// async.waterfall([
|
|
|
|
// function findImports(next) {
|
|
|
|
// webpack({
|
|
|
|
// entry: utils.joinPath(fs.dappPath(), file),
|
|
|
|
// output: {
|
|
|
|
// libraryTarget: 'umd',
|
|
|
|
// path: utils.joinPath(fs.dappPath(), '.embark'),
|
|
|
|
// filename: file
|
|
|
|
// },
|
|
|
|
// externals: function(context, request, callback) {
|
|
|
|
// if (request === utils.joinPath(fs.dappPath(), file)) {
|
|
|
|
// callback();
|
|
|
|
// } else {
|
|
|
|
// if (request === "Embark/EmbarkJS") {
|
|
|
|
// importsList["Embark/EmbarkJS"] = fs.embarkPath("js/embark.js");
|
|
|
|
// } else if (request === "Embark/test") {
|
|
|
|
// importsList["Embark/test"] = fs.embarkPath("js/test.js");
|
|
|
|
// }
|
|
|
|
// callback(null, "amd " + Math.random());
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// module: {
|
|
|
|
// rules: [
|
|
|
|
// {
|
|
|
|
// test: /\.css$/,
|
|
|
|
// use: [
|
|
|
|
// { loader: "style-loader" },
|
|
|
|
// { loader: "css-loader" }
|
|
|
|
// ]
|
|
|
|
// }
|
|
|
|
// ]
|
|
|
|
// }
|
|
|
|
// }).run((err, stats) => {
|
|
|
|
// next();
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
//
|
|
|
|
// function runWebpack(next) {
|
|
|
|
// webpack({
|
|
|
|
// entry: utils.joinPath(fs.dappPath(), file),
|
|
|
|
// output: {
|
|
|
|
// libraryTarget: 'umd',
|
|
|
|
// path: utils.joinPath(fs.dappPath(), '.embark'),
|
|
|
|
// filename: file
|
|
|
|
// },
|
|
|
|
// resolve: {
|
|
|
|
// alias: importsList
|
|
|
|
// },
|
|
|
|
// externals: function(context, request, callback) {
|
|
|
|
// if (request === "Embark/contracts/all") {
|
|
|
|
// return callback(null, fs.readFileSync(utils.joinPath(fs.dappPath(), '.embark', 'embark.js')));
|
|
|
|
// }
|
|
|
|
// callback();
|
|
|
|
// },
|
|
|
|
// module: {
|
|
|
|
// rules: [
|
|
|
|
// {
|
|
|
|
// test: /\.css$/,
|
|
|
|
// use: [
|
|
|
|
// { loader: "style-loader" },
|
|
|
|
// { loader: "css-loader" }
|
|
|
|
// ]
|
|
|
|
// }
|
|
|
|
// ]
|
|
|
|
// }
|
|
|
|
// }).run((err, stats) => {
|
|
|
|
// next();
|
|
|
|
// });
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// ], function(err, _result) {
|
|
|
|
// fileCallback(fs.readFileSync('./.embark/' + file).toString());
|
|
|
|
// });
|
|
|
|
//
|
|
|
|
// }}));
|
|
|
|
//
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-05 12:35:51 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
function (err, contentFiles) {
|
|
|
|
let dir = targetFile.split('/').slice(0, -1).join('/');
|
|
|
|
self.logger.trace("creating dir " + self.buildDir + dir);
|
|
|
|
fs.mkdirpSync(self.buildDir + dir);
|
|
|
|
|
|
|
|
// if it's a directory
|
|
|
|
if (targetFile.slice(-1) === '/' || targetFile.indexOf('.') === -1) {
|
|
|
|
let targetDir = targetFile;
|
|
|
|
|
|
|
|
if (targetDir.slice(-1) !== '/') {
|
|
|
|
targetDir = targetDir + '/';
|
|
|
|
}
|
|
|
|
|
|
|
|
contentFiles.map(function (file) {
|
|
|
|
let filename = file.filename.replace('app/', '');
|
|
|
|
filename = filename.replace(targetDir, '');
|
|
|
|
self.logger.info("writing file " + (self.buildDir + targetDir + filename).bold.dim);
|
|
|
|
|
|
|
|
fs.copySync(self.buildDir + targetDir + filename, file.path, {overwrite: true});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
let content = contentFiles.map(function (file) {
|
|
|
|
if (file === undefined) {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
return file.content;
|
|
|
|
}).join("\n");
|
2017-03-30 11:12:39 +00:00
|
|
|
|
2017-07-05 12:35:51 +00:00
|
|
|
self.logger.info("writing file " + (self.buildDir + targetFile).bold.dim);
|
|
|
|
fs.writeFileSync(self.buildDir + targetFile, content);
|
|
|
|
}
|
|
|
|
cb();
|
2017-03-30 11:12:39 +00:00
|
|
|
}
|
2017-07-05 12:35:51 +00:00
|
|
|
);
|
|
|
|
},
|
2017-12-05 23:14:46 +00:00
|
|
|
function (_err, _results) {
|
2017-07-05 12:35:51 +00:00
|
|
|
callback();
|
|
|
|
});
|
2017-04-04 10:37:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
buildContracts(contractsJSON) {
|
|
|
|
fs.mkdirpSync(this.buildDir + 'contracts');
|
|
|
|
|
|
|
|
for (let className in contractsJSON) {
|
|
|
|
let contract = contractsJSON[className];
|
|
|
|
fs.writeJSONSync(this.buildDir + 'contracts/' + className + ".json", contract, {spaces: 2});
|
|
|
|
}
|
2016-08-21 16:02:02 +00:00
|
|
|
}
|
2017-06-28 00:27:24 +00:00
|
|
|
|
|
|
|
buildContractJS(contractName) {
|
|
|
|
let contractJSON = fs.readFileSync('dist/contracts/' + contractName + '.json').toString();
|
2017-07-02 02:04:29 +00:00
|
|
|
//let EmbarkJSLib = fs.readFileSync(fs.embarkPath("js/embark.js")).toString();
|
2017-06-28 00:27:24 +00:00
|
|
|
|
|
|
|
let contractCode = "";
|
2017-12-12 18:51:14 +00:00
|
|
|
contractCode += "import web3 from 'Embark/web3';\n";
|
2017-12-12 17:20:57 +00:00
|
|
|
contractCode += "import EmbarkJS from 'Embark/EmbarkJS';\n";
|
2017-07-02 02:04:29 +00:00
|
|
|
contractCode += "let " + contractName + "JSONConfig = " + contractJSON + ";\n";
|
2017-12-12 17:20:57 +00:00
|
|
|
//contractCode += contractName + "JSONConfig.web3 = window.web3;\n";
|
2017-07-02 02:04:29 +00:00
|
|
|
//contractCode += EmbarkJSLib + "\n";
|
|
|
|
contractCode += "let " + contractName + " = new EmbarkJS.Contract(" + contractName + "JSONConfig);\n";
|
2017-12-12 17:20:57 +00:00
|
|
|
//contractCode += "if (typeof module !== 'undefined' && module.exports) {\n";
|
|
|
|
//contractCode += "module.exports = " + contractName + ";\n";
|
|
|
|
//contractCode += "}\n";
|
|
|
|
//contractCode += "window.contractWeb3 = web3;\n";
|
|
|
|
|
|
|
|
// on ready
|
|
|
|
// contractName.setProvider(web3.currentProvider
|
|
|
|
//ontractCode += "\n__embarkContext.__loadManagerInstance.execWhenReady(function() {\n";
|
|
|
|
contractCode += "\n__embarkContext.execWhenReady(function() {\n";
|
|
|
|
contractCode += "\nconsole.log('ready to set provider');\n";
|
|
|
|
contractCode += "\n" + contractName + ".setProvider(web3.currentProvider);\n";
|
|
|
|
contractCode += "\n});\n";
|
|
|
|
|
|
|
|
contractCode += "export default " + contractName + ";\n";
|
2017-06-28 00:27:24 +00:00
|
|
|
|
|
|
|
return contractCode;
|
|
|
|
}
|
2017-03-30 11:12:39 +00:00
|
|
|
}
|
2016-08-21 16:02:02 +00:00
|
|
|
|
|
|
|
module.exports = Pipeline;
|