mirror of https://github.com/embarklabs/embark.git
Changes based on code review
- Style changes for not requiring "else" in handlebar helpers - Changed build to async
This commit is contained in:
parent
2c18caf481
commit
fdb2d4aed3
|
@ -34,8 +34,7 @@ class Scaffolding {
|
|||
}
|
||||
|
||||
const contract = contractConfiguration.contracts[contractName];
|
||||
const result = build(contract);
|
||||
this.embark.logger.info(result);
|
||||
build(contract);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,25 +10,22 @@ Handlebars.registerHelper('ifview', function(stateMutability, options) {
|
|||
let result = stateMutability == 'view' || stateMutability == 'pure' || stateMutability == 'constant';
|
||||
if (result) {
|
||||
return options.fn(this);
|
||||
} else {
|
||||
return options.inverse(this);
|
||||
}
|
||||
}
|
||||
return options.inverse(this);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('ifeq', function(elem, value, options){
|
||||
if (elem == value) {
|
||||
return options.fn(this);
|
||||
} else {
|
||||
return options.inverse(this);
|
||||
}
|
||||
return options.inverse(this);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('iflengthgt', function(arr, val, options) {
|
||||
if (arr.length > val) {
|
||||
return options.fn(this);
|
||||
} else {
|
||||
return options.inverse(this);
|
||||
}
|
||||
}
|
||||
return options.inverse(this);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('emptyname', function(name, index) {
|
||||
|
@ -40,9 +37,8 @@ Handlebars.registerHelper('methodname', function(abiDefinition, functionName, in
|
|||
let funCount = abiDefinition.filter(x => x.name == functionName).length;
|
||||
if(funCount == 1){
|
||||
return '.' + functionName;
|
||||
} else {
|
||||
return new Handlebars.SafeString(`['${functionName}(${inputs !== null ? inputs.map(input => input.type).join(',') : '' })']`);
|
||||
}
|
||||
return new Handlebars.SafeString(`['${functionName}(${inputs !== null ? inputs.map(input => input.type).join(',') : ''})']`);
|
||||
});
|
||||
|
||||
class ScaffoldingReact {
|
||||
|
@ -78,7 +74,7 @@ class ScaffoldingReact {
|
|||
});
|
||||
}
|
||||
|
||||
build(contract){
|
||||
async build(contract){
|
||||
this._buildHTML(contract);
|
||||
|
||||
const filename = contract.className.toLowerCase();
|
||||
|
@ -98,7 +94,7 @@ class ScaffoldingReact {
|
|||
|
||||
fs.writeFileSync("./embark.json", JSON.stringify(embarkJson, null, 4));
|
||||
|
||||
return filename + ".html generated";
|
||||
this.embark.logger.info(filename + ".html generated");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue