mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-03 19:04:10 +00:00
Merge pull request #351 from embark-framework/fix/rainvij/fix-windows
Fix Windows Build due to PWD not existing
This commit is contained in:
commit
62352d0772
@ -289,6 +289,7 @@ class CodeGenerator {
|
||||
});
|
||||
},
|
||||
function getImports(web3Location, next) {
|
||||
web3Location = web3Location.replace(/\\/g, '/'); // Import paths must always have forward slashes
|
||||
code += "\nimport Web3 from '" + web3Location + "';\n";
|
||||
code += "\nimport web3 from 'Embark/web3';\n";
|
||||
next();
|
||||
|
@ -3,6 +3,15 @@ let async = require('async');
|
||||
|
||||
require('colors');
|
||||
|
||||
// Override process.chdir so that we have a partial-implementation PWD for Windows
|
||||
const realChdir = process.chdir;
|
||||
process.chdir = (...args) => {
|
||||
if (!process.env.PWD) {
|
||||
process.env.PWD = process.cwd();
|
||||
}
|
||||
realChdir(...args);
|
||||
};
|
||||
|
||||
let Engine = require('./core/engine.js');
|
||||
|
||||
let version = require('../package.json').version;
|
||||
|
@ -26,6 +26,23 @@ class Pipeline {
|
||||
|
||||
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
|
||||
async.eachOfLimit(self.assetFiles, 1, function (files, targetFile, cb) {
|
||||
// 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);
|
||||
|
||||
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;
|
||||
|
||||
@ -288,6 +289,7 @@ class Pipeline {
|
||||
});
|
||||
},
|
||||
function getImports(web3Location, next) {
|
||||
web3Location = web3Location.replace(/\\/g, '/'); // Import paths must always have forward slashes
|
||||
code += "\nimport Web3 from '" + web3Location + "';\n";
|
||||
|
||||
code += "\n if (typeof web3 !== 'undefined') {";
|
||||
|
Loading…
x
Reference in New Issue
Block a user