diff --git a/abstra_cli/resources/dashes.py b/abstra_cli/resources/dashes.py index e88fda4..a911ca2 100644 --- a/abstra_cli/resources/dashes.py +++ b/abstra_cli/resources/dashes.py @@ -232,6 +232,10 @@ def play(*args, **kwargs): @staticmethod def map_deploy_data(abstra_json_path: str, workspace_json_data: dict): abstra_json_dir = os.path.dirname(abstra_json_path) + base_path = utils.remove_suffix( + workspace_json_data["workspace"].get("base_path", ""), "/" + ) + dash_files = glob( os.path.join(abstra_json_dir, "**", "*.abstradash.json"), recursive=True, @@ -242,6 +246,9 @@ def map_deploy_data(abstra_json_path: str, workspace_json_data: dict): route = os.path.relpath( common_path, os.path.join(abstra_json_dir, ".") ).replace("\\", "/") + + route = utils.remove_prefix(route, f"{base_path}/") + script_path = common_path + ".py" dash_json_data = json.load(open(dash_file_path, "r")) prop = { diff --git a/abstra_cli/utils/main.py b/abstra_cli/utils/main.py index 09feb30..597b522 100644 --- a/abstra_cli/utils/main.py +++ b/abstra_cli/utils/main.py @@ -19,6 +19,12 @@ def remove_prefix(text, prefix): return text +def remove_suffix(text, suffix): + if text.endswith(suffix): + return text[: -len(suffix)] + return text + + def digits(n): return len(str(n))