Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .generator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,12 @@ def handle_configure(
)
prepared_config = _prepare_new_library_config(new_library_config)

# Create a `CHANGELOG.md` and `docs/CHANGELOG.md` file for the new library
is_mono_repo = _is_mono_repo(input)
library_id = _get_library_id(prepared_config)
_create_new_changelog_for_library(library_id, output)
path_to_library = f"packages/{library_id}" if is_mono_repo else "."
if not Path(f"{repo}/{path_to_library}").exists():
Comment on lines +295 to +296

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For improved readability and cross-platform compatibility, it's better to use pathlib's / operator for joining path components rather than f-string formatting. This is the idiomatic way to work with pathlib and avoids potential issues with path separators.

Suggested change
path_to_library = f"packages/{library_id}" if is_mono_repo else "."
if not Path(f"{repo}/{path_to_library}").exists():
path_to_library_str = f"packages/{library_id}" if is_mono_repo else "."
if not (Path(repo) / path_to_library_str).exists():

# Create a `CHANGELOG.md` and `docs/CHANGELOG.md` file for the new library
_create_new_changelog_for_library(library_id, output)

# Write the new library configuration to configure-response.json.
_write_json_file(f"{librarian}/configure-response.json", prepared_config)
Expand Down
Loading