fix: improve project favicon detection for monorepos#1024
fix: improve project favicon detection for monorepos#1024ponbac wants to merge 1 commit intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.OpenGrep is compatible with Semgrep configurations. Add an |
30cac2c to
b936f17
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4a8d330eb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
b936f17 to
c396c88
Compare
What Changed
Improve project favicon detection without introducing a broad recursive search.
Closes #1020.
Rules, in order:
Example:
/repo/favicon.svgor/repo/public/favicon.ico.<link rel="icon" ... href="...">tags or object-style{ href, rel: "icon" }declarations in a small set of common source files, then resolve that target.Example:
/repo/index.htmlpoints to/brand/logo.svg, so the route first tries/repo/public/brand/logo.svgand then/repo/brand/logo.svg.apps/andpackages/, plus other top-level directories in the requested root, using the same non-git directory ignore rules asworkspaceEntries.Example:
/repo/apps/web/public/favicon.pngor/repo/frontend/public/favicon.pngis found when the cwd is/repo.Example:
/repo/favicon.svgwins over/repo/apps/web/public/favicon.ico.I also extracted the shared gitignore probing into
apps/server/src/gitIgnore.tsso bothworkspaceEntriesandprojectFaviconRouteuse the same chunkedgit check-ignore --no-index -z --stdinfiltering. I also extracted the shared workspace directory ignore policy intoapps/server/src/workspaceIgnore.ts, soprojectFaviconRoutenow uses the same non-git skip rules asworkspaceEntrieswhen scanning nested roots instead of keeping a separate ignore list.Why
The current behavior misses common monorepo layouts where the favicon lives under an app directory instead of the repo root.
There was already an earlier PR for this in the upstream repo: #690. That version was larger and messier. This keeps the rules simple on purpose, leaving more extensive changes to project icons for trusted maintainers.
UI Changes
Not applicable.
Checklist
Note
Fix project favicon detection to support monorepo layouts with gitignore awareness
tryHandleProjectFaviconRequestinprojectFaviconRoute.tsto run as an Effect with aFileSystemservice, replacing the previous synchronous handler.gitIgnore.tsmodule that usesgit check-ignore --stdinbatching to skip ignored candidates.apps/,packages/, top-level dirs) and source files (index.html,src/root.tsx,app/root.tsx) to resolve favicons in nested apps, preferring the project root favicon first.workspaceIgnore.tsand updatesworkspaceEntries.tsto import from the new modules.Macroscope summarized c396c88.