Skip to content

feat: add support for custom patch delimiters in PatchDocumentOptions #3036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

venkateshwarreddyr
Copy link
Contributor

@venkateshwarreddyr venkateshwarreddyr commented Apr 11, 2025

Resolves: #2972

What does this PR do?

Adds support for customizable placeholder delimiters in the patchDocument function.

This allows users to define delimiters other than {{ }}, such as << >>, { }, or any custom format.


Why is this needed?

Currently, the placeholder syntax is hardcoded to use {{ }}. This enhancement enables more flexibility when using different template styles or avoiding syntax collisions.


How does it work?

  • Added an optional placeholderDelimiters field to PatchDocumentOptions.
  • Fallback to default delimiters {{ and }} if none provided.
  • Adjusted how patchText is built.
  • Updated types to include readonly as per lint rules.
  • Added test cases to cover custom delimiters and edge cases.

Screenshots / Test Evidence

✅ Added tests for:

  • default delimiters
  • custom delimiters: {{}}
  • error on empty string delimiters

Checklist

  • I’ve added/updated tests
  • I’ve run npm run lint
  • I’ve run npm run test
  • Code follows existing style guidelines
  • PR title uses conventional commit format (feat:, fix:, etc.)

Let me know if you'd like any changes!

@venkateshwarreddyr
Copy link
Contributor Author

venkateshwarreddyr commented Apr 11, 2025

Feature request: #2972

Copy link

codecov bot commented Apr 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (8ba9a44) to head (3a96018).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3036   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          290       290           
  Lines         8764      8769    +5     
  Branches      1413      1421    +8     
=========================================
+ Hits          8764      8769    +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dolanmiu dolanmiu self-requested a review April 16, 2025 07:18
@dolanmiu dolanmiu merged commit 5af1045 into dolanmiu:master Apr 16, 2025
8 checks passed
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.

Feature request: Give user ability to provide a patcher pattern
2 participants