-
Notifications
You must be signed in to change notification settings - Fork 444
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
Include icons used in enabled apps while treeshaking the icons #9068
Conversation
WalkthroughThe changes in this pull request focus on the Changes
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Deploying care-fe with Cloudflare Pages
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
plugins/treeShakeCareIcons.ts (2)
Line range hint
24-29
: Consider making the root directory path configurable.The comment "update this if moving this code to a different file" suggests a brittle implementation. Consider making the root directory path configurable through the options interface to improve maintainability.
export interface TreeShakeCareIconsOptions { iconWhitelist: string[]; + rootDir?: string; } export function treeShakeCareIcons( options: TreeShakeCareIconsOptions = { iconWhitelist: [] }, ): Plugin { - const rootDir = path.resolve(__dirname, ".."); // update this if moving this code to a different file + const rootDir = options.rootDir || path.resolve(__dirname, "..");
Line range hint
69-71
: Enhance error message with more context.While the error handling is good, the error message could be more informative to help developers quickly identify the source of the issue.
- throw new Error(`Icon ${iconName} is not found in UniconPaths.json`); + throw new Error( + `Icon "${iconName}" is not found in UniconPaths.json. ` + + `Please ensure the icon exists or add it to the iconWhitelist if needed.` + );
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
plugins/treeShakeCareIcons.ts
(2 hunks)
🔇 Additional comments (2)
plugins/treeShakeCareIcons.ts (2)
3-4
: LGTM! Well-structured interface and clean imports.
The TreeShakeCareIconsOptions
interface is properly documented and typed, providing a clear contract for the plugin options.
Also applies to: 13-15
51-51
: Verify completeness of file extension patterns.
The glob pattern now correctly includes both apps
and src
directories. However, let's verify if there are any other file extensions that might contain icon references.
✅ Verification successful
Based on the results, I can now generate the final response since I have sufficient information about icon usage patterns in the codebase.
The current file extension pattern is sufficient for icon references
The glob pattern {apps,src}/**/*.{tsx,res}
is appropriate as the search results show that icon references primarily exist in TypeScript/React components (.tsx
) and ReScript (.res
) files. While there are icon definitions in .ts
files (like iconMap.ts
), these are just mapping files that don't represent actual icon usage in the UI.
The only other icon-related files found are:
UniconPaths.json
: Contains icon definitions/paths- Configuration/build files that don't need scanning for tree-shaking
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for potential icon usage in files with different extensions
# Test 1: Find all unique file extensions in the codebase
echo "Unique file extensions in the codebase:"
fd -t f -x basename {} \; | grep -o '\.[^.]*$' | sort -u
# Test 2: Search for line icon patterns in files with extensions other than .tsx and .res
echo -e "\nChecking for icon usage in other file types:"
rg -g '!*.{tsx,res}' '"l-[a-z]+(?:-[a-z]+)*"'
Length of output: 66895
CARE Run #3846
Run Properties:
|
Project |
CARE
|
Branch Review |
app-icons-treeshaking
|
Run status |
Passed #3846
|
Run duration | 04m 28s |
Commit |
0e32531351: Include icons used in enabled apps while treeshaking the icons
|
Committer | Khavin Shankar |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
0
|
Pending |
0
|
Skipped |
0
|
Passing |
125
|
View all changes introduced in this branch ↗︎ |
@khavinshankar Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌 |
Proposed Changes
@ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit
New Features
apps
andsrc
directories.Bug Fixes