validateMorphemeYaml static method
Validates the existence of a morpheme.yaml file.
This method checks if a morpheme.yaml file exists in the current directory or at a specified custom path. If the file is not found, it reports an error and exits the application.
Parameters:
morphemeYaml: Optional custom path to the morpheme.yaml file
Example:
// Validate default morpheme.yaml in current directory
YamlHelper.validateMorphemeYaml();
// Validate custom path
YamlHelper.validateMorphemeYaml('./config/morpheme.yaml');
Note: If the morpheme.yaml file is not found, this method will terminate the application with an error message.
Implementation
static void validateMorphemeYaml([String? morphemeYaml]) {
if (!exists(join(current, 'morpheme.yaml')) && morphemeYaml == null) {
StatusHelper.failed(
'You don\'t have "morpheme.yaml" in root apps, make sure to "morpheme init" first');
} else if (morphemeYaml != null && !exists(morphemeYaml)) {
StatusHelper.failed(
'Not found custom path morpheme.yaml in "$morphemeYaml"');
}
}