add support for embark_js directive
This commit is contained in:
parent
0e904bba33
commit
0991a87b73
|
@ -229,7 +229,7 @@ Config.prototype.loadFiles = function(files) {
|
|||
|
||||
// get embark.js object first
|
||||
originalFiles.filter(function(file) {
|
||||
return file.indexOf('.') >= 0;
|
||||
return (file[0] === '$' || file.indexOf('.') >= 0);
|
||||
}).filter(function(file) {
|
||||
if (file === 'embark.js') {
|
||||
|
||||
|
@ -249,6 +249,9 @@ Config.prototype.loadFiles = function(files) {
|
|||
|
||||
readFiles.push({filename: 'embark.js', content: fs.readFileSync(fs.embarkPath("js/build/embark.bundle.js")).toString(), path: fs.embarkPath("js/build/embark.bundle.js")});
|
||||
}
|
||||
if (file === '$EMBARK_JS') {
|
||||
readFiles.push({filename: '$EMBARK_JS', content: fs.readFileSync(fs.embarkPath("js/build/embark.bundle.js")).toString(), path: fs.embarkPath("js/build/embark.bundle.js")});
|
||||
}
|
||||
if (file.indexOf("web3-") === 0) {
|
||||
let web3Version = file.split('web3-')[1].split(".js")[0];
|
||||
npm.getPackageVersion('web3', web3Version, function(web3Content) {
|
||||
|
|
|
@ -25,6 +25,8 @@ class Pipeline {
|
|||
|
||||
if (file.filename === "$ALL_CONTRACTS") {
|
||||
return {content: abi, filename: file.filename, path: file.path, modified: true};
|
||||
} else if (file.filename === "$EMBARK_JS") {
|
||||
return {content: file.content, filename: "embark.js", path: file.path, modified: true};
|
||||
} else if (file.filename[0] === '$') {
|
||||
let contractName = file.filename.substr(1);
|
||||
return {content: this.buildContractJS(contractName), filename: contractName + ".js", path: file.path, modified: true};
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
"test2.html": "app/test2.html",
|
||||
"js/myweb3.js": "web3-0.18.js",
|
||||
"js/web3.js": "web3.js",
|
||||
"js/all_contracts.js": "$ALL_CONTRACTS"
|
||||
"js/all_contracts.js": "$ALL_CONTRACTS",
|
||||
"js/only_embark.js": "$EMBARK_JS"
|
||||
},
|
||||
"buildDir": "dist/",
|
||||
"config": "config/",
|
||||
|
|
Loading…
Reference in New Issue