[7359] Add support for alternate Freemarker suffixes besides .ftl (.ftlh .ftlx) #4893
[7359] Add support for alternate Freemarker suffixes besides .ftl (.ftlh .ftlx) #4893jvega190 wants to merge 4 commits into
Conversation
|
Depends on craftercms/craftercms#8737 |
|
Warning Review limit reached
More reviews will be available in 27 minutes and 12 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughAdds a file-extension dropdown to ChangesTemplate File Extension Selector
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ui/app/src/components/CreateFileDialog/utils.ts`:
- Around line 39-41: The TEMPLATE_EXTENSIONS array lacks the `as const`
modifier, causing TypeScript to infer the type as a generic string array rather
than preserving the literal types of the individual elements. This causes the
TemplateExtension type to widen to string instead of the intended literal union
type (ftl | ftlh | ftlx), which necessitates an unsafe type cast workaround in
CreateFileDialogContainer.tsx. Add `as const` to the end of the
TEMPLATE_EXTENSIONS array definition to force TypeScript to preserve the literal
types, which will automatically narrow TemplateExtension to the correct union
type and eliminate the need for the type cast workaround.
In `@ui/app/src/utils/path.ts`:
- Around line 364-367: The regex pattern in the first replace call within
getFileNameWithExtensionForItemType only handles de-duplication of .groovy and
.ftl extensions, but with the new .ftlh and .ftlx extensions added in this PR,
duplicated instances of these new extensions (e.g., name.ftlh.ftlh or
name.ftlx.ftlx) will not be caught. Update the regex pattern to include
alternation groups for both .ftlh and .ftlx extensions alongside the existing
.groovy and .ftl patterns, ensuring all four extension types are properly
de-duplicated when they appear consecutively.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fbe12d09-64a5-4b55-a04f-248f71bbf73b
📒 Files selected for processing (3)
ui/app/src/components/CreateFileDialog/CreateFileDialogContainer.tsxui/app/src/components/CreateFileDialog/utils.tsui/app/src/utils/path.ts
…by removing existing extensions before appending the picked extension.
craftercms/craftercms#7359
Summary by CodeRabbit