Skip to content

Commit

Permalink
Use utils function
Browse files Browse the repository at this point in the history
  • Loading branch information
mephenor committed May 3, 2024
1 parent 42c2d19 commit 2d90729
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions scripts/update_readme_monorepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from stringcase import spinalcase, titlecase

from script_utils.cli import echo_failure, echo_success, run
from script_utils.utils import list_service_dirs

ROOT_DIR = Path(__file__).parent.parent.resolve()
PYPROJECT_TOML_PATH = ROOT_DIR / "pyproject.toml"
Expand Down Expand Up @@ -142,9 +143,8 @@ def get_service_readmes() -> str:
"""TODO"""

service_readme_links = []
service_dirs = [service for service in SERVICE_ROOT.iterdir() if service.is_dir()]

for service_dir in sorted(service_dirs):
for service_dir in sorted(list_service_dirs()):
service_description = read_service_description(service_dir)
readme_link = service_dir.relative_to(ROOT_DIR) / "README.md"
service_readme_links.append(f"[{service_description}]({readme_link})")
Expand Down
7 changes: 2 additions & 5 deletions scripts/update_readme_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
from pydantic import BaseModel, Field

from script_utils.cli import echo_failure, echo_success, run
from script_utils.utils import list_service_dirs

ROOT_DIR = Path(__file__).parent.parent.resolve()
README_TEMPLATE_PATH = ROOT_DIR / ".readme_generation" / "readme_template_service.md"
SERVICE_ROOT = ROOT_DIR / "services"


class PackageHeader(BaseModel):
Expand Down Expand Up @@ -181,10 +181,7 @@ def generate_single_readme(*, details: PackageDetails) -> str:
def main(check: bool = False) -> None:
"""Update the readme markdown."""

for service_dir in SERVICE_ROOT.iterdir():
if not service_dir.is_dir():
continue

for service_dir in list_service_dirs():
service_name = service_dir.name
service_details = ServiceDetails(service_dir=service_dir)

Expand Down

0 comments on commit 2d90729

Please sign in to comment.