mirror of https://github.com/embarklabs/embark.git
move import list out of loop to accelerate build process
This commit is contained in:
parent
f37b09a371
commit
3ecb195b38
|
@ -26,6 +26,23 @@ class Pipeline {
|
||||||
|
|
||||||
self.buildWeb3JS(function() {
|
self.buildWeb3JS(function() {
|
||||||
|
|
||||||
|
let importsList = {};
|
||||||
|
|
||||||
|
importsList["Embark/EmbarkJS"] = fs.dappPath(".embark", 'embark.js');
|
||||||
|
importsList["Embark/web3"] = fs.dappPath(".embark", 'web3_instance.js');
|
||||||
|
|
||||||
|
self.plugins.getPluginsProperty('imports', 'imports').forEach(function (importObject) {
|
||||||
|
let [importName, importLocation] = importObject;
|
||||||
|
importsList[importName] = importLocation;
|
||||||
|
});
|
||||||
|
|
||||||
|
for (let contractName in contractsJSON) {
|
||||||
|
let contractCode = self.buildContractJS(contractName);
|
||||||
|
let filePath = fs.dappPath(".embark", contractName + '.js');
|
||||||
|
fs.writeFileSync(filePath, contractCode);
|
||||||
|
importsList["Embark/contracts/" + contractName] = filePath;
|
||||||
|
}
|
||||||
|
|
||||||
// limit:1 due to issues when downloading required files such as web3.js
|
// limit:1 due to issues when downloading required files such as web3.js
|
||||||
async.eachOfLimit(self.assetFiles, 1, function (files, targetFile, cb) {
|
async.eachOfLimit(self.assetFiles, 1, function (files, targetFile, cb) {
|
||||||
// limit:1 due to issues when downloading required files such as web3.js
|
// limit:1 due to issues when downloading required files such as web3.js
|
||||||
|
@ -34,22 +51,6 @@ class Pipeline {
|
||||||
self.logger.trace("reading " + file.filename);
|
self.logger.trace("reading " + file.filename);
|
||||||
|
|
||||||
if (file.filename.indexOf('.js') >= 0) {
|
if (file.filename.indexOf('.js') >= 0) {
|
||||||
let importsList = {};
|
|
||||||
|
|
||||||
importsList["Embark/EmbarkJS"] = fs.dappPath(".embark", 'embark.js');
|
|
||||||
importsList["Embark/web3"] = fs.dappPath(".embark", 'web3_instance.js');
|
|
||||||
|
|
||||||
self.plugins.getPluginsProperty('imports', 'imports').forEach(function (importObject) {
|
|
||||||
let [importName, importLocation] = importObject;
|
|
||||||
importsList[importName] = importLocation;
|
|
||||||
});
|
|
||||||
|
|
||||||
for (let contractName in contractsJSON) {
|
|
||||||
let contractCode = self.buildContractJS(contractName);
|
|
||||||
let filePath = fs.dappPath(".embark", contractName + '.js');
|
|
||||||
fs.writeFileSync(filePath, contractCode);
|
|
||||||
importsList["Embark/contracts/" + contractName] = filePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
let realCwd;
|
let realCwd;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue