make file changes in the pipelins

This commit is contained in:
Iuri Matias 2018-05-15 18:21:00 -04:00
parent 1f6e386d9b
commit 7271b00cf4
2 changed files with 19 additions and 10 deletions

View File

@ -353,15 +353,7 @@ class CodeGenerator {
code += "\nglobal.__embarkContext = __mainContext.__loadManagerInstance;\n";
code += "\nwindow.web3 = web3;\n";
code += "\nexport default web3;\n";
next();
},
function makeDirectory(next) {
fs.mkdirp(fs.dappPath(".embark"), (err, _result) => {
next(err);
});
},
function writeFile(next) {
fs.writeFile(fs.dappPath(".embark", 'web3_instance.js'), code, next);
next(null, code);
}
], cb);
}

View File

@ -31,7 +31,7 @@ class Pipeline {
self.buildContracts(contractsJSON, next);
},
function buildWeb3(next) {
self.events.request('code-generator:web3js', next);
self.buildWeb3JS(next);
},
function createImportList(next) {
importsList["Embark/EmbarkJS"] = fs.dappPath(".embark", 'embark.js');
@ -211,6 +211,23 @@ class Pipeline {
});
}
buildWeb3JS(cb) {
const self = this;
async.waterfall([
function getWeb3Code(next) {
self.events.request('code-generator:web3js', next);
},
function makeDirectory(code, next) {
fs.mkdirp(fs.dappPath(".embark"), (err, _result) => {
next(err, code);
});
},
function writeFile(code, next) {
fs.writeFile(fs.dappPath(".embark", 'web3_instance.js'), code, next);
}
], cb);
}
}
module.exports = Pipeline;