🐛 fix(types.py): fix syntax error in adding component_template to valid_menu
✨ feat(types.py): improve component name generation logic based on component_output_types and file name
This commit is contained in:
parent
1a02e61701
commit
47fe4481f3
1 changed files with 16 additions and 1 deletions
|
|
@ -347,8 +347,23 @@ def build_valid_menu(valid_components):
|
|||
component_extractor
|
||||
)
|
||||
component_template["output_types"] = component_output_types
|
||||
if len(component_output_types) == 1:
|
||||
component_name = component_output_types[0]
|
||||
else:
|
||||
file_name = component.get("file").split(".")[0]
|
||||
if "_" in file_name:
|
||||
# turn .py file into camelcase
|
||||
component_name = "".join(
|
||||
[
|
||||
word.capitalize()
|
||||
for word in file_name.split("_")
|
||||
]
|
||||
)
|
||||
else:
|
||||
component_name = file_name
|
||||
|
||||
valid_menu[menu_name][component.get("file")] = component_template
|
||||
|
||||
valid_menu[menu_name][] = component_template
|
||||
logger.debug(f"Added {component_name} to valid menu to {menu_name}")
|
||||
|
||||
except Exception as exc:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue