mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-17 01:37:26 +00:00
async buildContractJs
This commit is contained in:
parent
4ec7fbb9db
commit
a03777dc65
@ -75,10 +75,11 @@ class Pipeline {
|
||||
},
|
||||
function writeContracts(next) {
|
||||
async.each(Object.keys(contractsJSON), (contractName, eachCb) => {
|
||||
let contractCode = self.buildContractJS(contractName);
|
||||
self.buildContractJS(contractName, (err, contractCode) => {
|
||||
let filePath = fs.dappPath(".embark", contractName + '.js');
|
||||
importsList["Embark/contracts/" + contractName] = filePath;
|
||||
fs.writeFile(filePath, contractCode, eachCb);
|
||||
});
|
||||
}, next);
|
||||
},
|
||||
function assetFileWrite(next) {
|
||||
@ -310,8 +311,12 @@ class Pipeline {
|
||||
});
|
||||
}
|
||||
|
||||
buildContractJS(contractName) {
|
||||
let contractJSON = fs.readFileSync(fs.dappPath(this.buildDir, 'contracts', contractName + '.json')).toString();
|
||||
buildContractJS(contractName, callback) {
|
||||
fs.readFile(fs.dappPath(this.buildDir, 'contracts', contractName + '.json'), (err, contractJSON) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
contractJSON = contractJSON.toString();
|
||||
|
||||
let contractCode = "";
|
||||
contractCode += "import web3 from 'Embark/web3';\n";
|
||||
@ -324,8 +329,8 @@ class Pipeline {
|
||||
contractCode += "\n});\n";
|
||||
|
||||
contractCode += "export default " + contractName + ";\n";
|
||||
|
||||
return contractCode;
|
||||
callback(null, contractCode);
|
||||
});
|
||||
}
|
||||
|
||||
buildWeb3JS(cb) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user