🔧 fix(directory_reader.py): change component name from snake_case to CamelCase for better UI display

📝 chore(directory_reader.py): add comments to explain the purpose of changing the component name
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-03 13:48:57 -03:00
commit c11204d3c5

View file

@ -224,9 +224,15 @@ class DirectoryReader:
"path": os.path.dirname(file_path),
"components": [],
}
component_name = filename.split(".")[0]
# This is the name of the file which will be displayed in the UI
# We need to change it from snake_case to CamelCase
camel_case_name = " ".join(
word.title() for word in component_name.split("_")
)
component_info = {
"name": filename.split(".")[0],
"name": camel_case_name,
"file": filename,
"code": result_content if validation_result else "",
"error": "" if validation_result else result_content,