joomla / Manual

Joomla Developer Documentation
28 stars 57 forks source link

Update npm and monkey patch search #283

Closed HLeithner closed 3 months ago

HLeithner commented 3 months ago

User description

Updated npm dependencies and patch @cmfcmf/docusaurus-search-local manually with https://github.com/cmfcmf/docusaurus-search-local/pull/216


PR Type

Enhancement, Bug fix


Description


Changes walkthrough ๐Ÿ“

Relevant files
Enhancement
package.json
Update dependencies and add postinstall script                     

package.json
  • Added postinstall script to run patch-package
  • Updated @cmfcmf/docusaurus-search-local to version 1.2.0
  • Updated several other dependencies to their latest versions
  • Added patch-package as a new dependency
  • +11/-9   
    Bug fix
    @cmfcmf+docusaurus-search-local+1.2.0.patch
    Patch `html2text` function in docusaurus-search-local       

    patches/@cmfcmf+docusaurus-search-local+1.2.0.patch - Patched `html2text` function to correctly handle hash links
    +15/-0   
    Additional files (token-limit)
    package-lock.json
    ...                                                                                                           

    package-lock.json ...
    +1327/-1262

    ๐Ÿ’ก PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    codiumai-pr-agent-pro[bot] commented 3 months ago

    PR Reviewer Guide ๐Ÿ”

    โฑ๏ธ Estimated effort to review: 2 ๐Ÿ”ต๐Ÿ”ตโšชโšชโšช
    ๐Ÿงช No relevant tests
    ๐Ÿ”’ No security concerns identified
    โšก Key issues to review

    Dependency Management
    The PR updates several dependencies to their latest versions. It's crucial to ensure that these updates do not introduce any breaking changes or compatibility issues with the existing codebase. Additionally, the introduction of the `patch-package` dependency and the `postinstall` script to apply patches should be carefully reviewed to ensure they do not affect the deployment process or introduce potential errors during installation. Patch Application
    The patch modifies the behavior of the `html2text` function in the `@cmfcmf/docusaurus-search-local` package. It's important to verify that the changes in the patch correctly address the issue without introducing new bugs or side effects, especially since it involves manipulating URL hash links.
    codiumai-pr-agent-pro[bot] commented 3 months ago

    PR Code Suggestions โœจ

    CategorySuggestion                                                                                                                                    Score
    Possible bug
    Add error handling for split operation in patch ___ **Ensure that the patch handles potential null or undefined values for
    linkHash.split("#") to avoid runtime errors.** [patches/@cmfcmf+docusaurus-search-local+1.2.0.patch [11]](https://github.com/joomla/Manual/pull/283/files#diff-5b384f86763d4f3b899d04e1c957493b350d7cca4d1a451b8e766a2553974d6bR11-R11) ```diff -const [, hashPart] = linkHash.split("#") +const [, hashPart] = linkHash.split("#") || ["", ""] ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 9 Why: Adding error handling for the split operation is crucial to avoid potential runtime errors, improving the robustness of the patch.
    9
    Best practice
    Use exact versions for critical tools like patch-package ___ **For the patch-package dependency, it's a good practice to specify the exact version
    to avoid potential issues with patching when the package updates.** [package.json [25]](https://github.com/joomla/Manual/pull/283/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R25-R25) ```diff -"patch-package": "^8.0.0", +"patch-package": "8.0.0", ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 8 Why: Specifying exact versions for critical tools like `patch-package` can prevent unexpected issues due to updates, ensuring more stable builds.
    8