mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-19 18:48:18 +00:00
use es string templates
This commit is contained in:
parent
9cd3cb6891
commit
15467e6f49
@ -303,7 +303,7 @@ class CodeGenerator {
|
|||||||
},
|
},
|
||||||
function getImports(web3Location, next) {
|
function getImports(web3Location, next) {
|
||||||
web3Location = web3Location.replace(/\\/g, '/'); // Import paths must always have forward slashes
|
web3Location = web3Location.replace(/\\/g, '/'); // Import paths must always have forward slashes
|
||||||
code += "\nimport Web3 from '" + web3Location + "';\n";
|
code += `\nimport Web3 from '${web3Location}';\n`;
|
||||||
code += "\nimport web3 from 'Embark/web3';\n";
|
code += "\nimport web3 from 'Embark/web3';\n";
|
||||||
code += "\nimport IpfsApi from 'ipfs-api';\n";
|
code += "\nimport IpfsApi from 'ipfs-api';\n";
|
||||||
|
|
||||||
@ -339,9 +339,9 @@ class CodeGenerator {
|
|||||||
let contractCode = "";
|
let contractCode = "";
|
||||||
contractCode += "import web3 from 'Embark/web3';\n";
|
contractCode += "import web3 from 'Embark/web3';\n";
|
||||||
contractCode += "import EmbarkJS from 'Embark/EmbarkJS';\n";
|
contractCode += "import EmbarkJS from 'Embark/EmbarkJS';\n";
|
||||||
contractCode += "let " + contractName + "JSONConfig = " + JSON.stringify(contractJSON) + ";\n";
|
contractCode += `let ${contractName}JSONConfig = ${JSON.stringify(contractJSON)};\n`;
|
||||||
contractCode += contractName + "JSONConfig.web3 = web3;\n";
|
contractCode += `${contractName}JSONConfig.web3 = web3;\n`;
|
||||||
contractCode += "let " + contractName + " = new EmbarkJS.Blockchain.Contract(" + contractName + "JSONConfig);\n";
|
contractCode += `let ${contractName} = new EmbarkJS.Blockchain.Contract(${contractName}JSONConfig);\n`;
|
||||||
|
|
||||||
contractCode += "export default " + contractName + ";\n";
|
contractCode += "export default " + contractName + ";\n";
|
||||||
cb(contractCode);
|
cb(contractCode);
|
||||||
@ -364,7 +364,7 @@ class CodeGenerator {
|
|||||||
},
|
},
|
||||||
function getImports(web3Location, next) {
|
function getImports(web3Location, next) {
|
||||||
web3Location = web3Location.replace(/\\/g, '/'); // Import paths must always have forward slashes
|
web3Location = web3Location.replace(/\\/g, '/'); // Import paths must always have forward slashes
|
||||||
code += "\nimport Web3 from '" + web3Location + "';\n";
|
code += `\nimport Web3 from '${web3Location}';\n`;
|
||||||
code += "\nglobal.Web3 = Web3;\n";
|
code += "\nglobal.Web3 = Web3;\n";
|
||||||
|
|
||||||
code += "\n if (typeof web3 === 'undefined') {";
|
code += "\n if (typeof web3 === 'undefined') {";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user