There is currently a mismatch between the a commands .validate method and the ValidateHelper. .validate returns type of boolean but the ValidateHelper returns a Promise, meaning you can't use the helper in a command. Making .validate async would fix this issue.
Code
validate(helper: Helper) {
let schema;
try {
schema = JSON.parse(readFileSync(path.join(__dirname, 'schema.json')).toString());
} catch (error) {
return Promise.reject(Error('The dojorc schema for cli-build-app could not be read: ' + error));
}
return helper.validation.validate({
commandGroup: command.group as string,
commandName: command.name,
commandSchema: schema,
commandConfig: helper.configuration.get(),
silentSuccess: true
});
}
Expected behavior:
You should be able to use the provided ValidateHelper in the .validate function.
Actual behavior:
ValidateHelper is async which stops it from being useable.
Bug
There is currently a mismatch between the a commands
.validate
method and the ValidateHelper..validate
returns type of boolean but the ValidateHelper returns a Promise, meaning you can't use the helper in a command. Making.validate
async would fix this issue.Code
Expected behavior:
You should be able to use the provided
ValidateHelper
in the.validate
function.Actual behavior:
ValidateHelper
is async which stops it from being useable.