Skip to content

fix: improve robustness of README section replacement#5

Open
MatrixNeoKozak wants to merge 1 commit into
justoneapi:mainfrom
MatrixNeoKozak:fix/improvement-1781190072347
Open

fix: improve robustness of README section replacement#5
MatrixNeoKozak wants to merge 1 commit into
justoneapi:mainfrom
MatrixNeoKozak:fix/improvement-1781190072347

Conversation

@MatrixNeoKozak

Copy link
Copy Markdown
  1. Summary of changes:
    Refactor replaceApiListSection in scripts/update-readme-api-list.mjs to reliably replace the entire API list section, including its header, by using the H2 header as the starting point and <!-- API_LIST_END --> as the ending point. Added a try...catch block to handle file writing errors.

  2. Rationale behind the implementation:
    The previous implementation was brittle because it relied on searching for the next H2 header to determine the end of the section, which could lead to incorrectly including subsequent documentation sections. By using the <!-- API_LIST_END --> marker as the definitive end point, the replacement is now deterministic and safe from structural variations in the README.

  3. Technical impact analysis:
    This change increases the reliability of automated documentation updates, prevents corruption of the README structure, and improves error reporting during file system operations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant