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 contract = contractConfiguration.contracts[contractName];
|
||||||
const result = build(contract);
|
build(contract);
|
||||||
this.embark.logger.info(result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,25 +10,22 @@ Handlebars.registerHelper('ifview', function(stateMutability, options) {
|
||||||
let result = stateMutability == 'view' || stateMutability == 'pure' || stateMutability == 'constant';
|
let result = stateMutability == 'view' || stateMutability == 'pure' || stateMutability == 'constant';
|
||||||
if (result) {
|
if (result) {
|
||||||
return options.fn(this);
|
return options.fn(this);
|
||||||
} else {
|
}
|
||||||
return options.inverse(this);
|
return options.inverse(this);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper('ifeq', function(elem, value, options){
|
Handlebars.registerHelper('ifeq', function(elem, value, options){
|
||||||
if (elem == value) {
|
if (elem == value) {
|
||||||
return options.fn(this);
|
return options.fn(this);
|
||||||
} else {
|
|
||||||
return options.inverse(this);
|
|
||||||
}
|
}
|
||||||
|
return options.inverse(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper('iflengthgt', function(arr, val, options) {
|
Handlebars.registerHelper('iflengthgt', function(arr, val, options) {
|
||||||
if (arr.length > val) {
|
if (arr.length > val) {
|
||||||
return options.fn(this);
|
return options.fn(this);
|
||||||
} else {
|
}
|
||||||
return options.inverse(this);
|
return options.inverse(this);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper('emptyname', function(name, index) {
|
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;
|
let funCount = abiDefinition.filter(x => x.name == functionName).length;
|
||||||
if(funCount == 1){
|
if(funCount == 1){
|
||||||
return '.' + functionName;
|
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 {
|
class ScaffoldingReact {
|
||||||
|
@ -78,7 +74,7 @@ class ScaffoldingReact {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
build(contract){
|
async build(contract){
|
||||||
this._buildHTML(contract);
|
this._buildHTML(contract);
|
||||||
|
|
||||||
const filename = contract.className.toLowerCase();
|
const filename = contract.className.toLowerCase();
|
||||||
|
@ -98,7 +94,7 @@ class ScaffoldingReact {
|
||||||
|
|
||||||
fs.writeFileSync("./embark.json", JSON.stringify(embarkJson, null, 4));
|
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