Feat/sidebar-svelte-favicon-support#515
Feat/sidebar-svelte-favicon-support#515stickerdaniel wants to merge 7 commits intopingdotgg:mainfrom
Conversation
Resolve project icons from src/app.html, including %sveltekit.assets% paths, before falling back to sidebar-specific SVG assets for generic and Svelte projects. Load the fallback SVGs from checked-in asset files, include the Affinity source file in the repo, and copy the runtime SVG assets into dist/assets during server builds.
Keep a fixed-size icon slot in the project list and show the folder placeholder until the favicon request finishes so project names no longer jump when the server-backed icon loads.
|
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)
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.
Pull request overview
Adds Svelte/SvelteKit-aware project favicon handling end-to-end (server detection + assets) and updates the web sidebar favicon rendering to avoid layout shift while favicons load.
Changes:
- Sidebar favicon slot now stays fixed-size and only shows the image once loaded (with an error fallback icon).
- Server favicon route can resolve SvelteKit
%sveltekit.assets%/…links and returns a Svelte-specific SVG fallback when no favicon is found. - Introduces server-side SVG asset loading/copying into
dist/assetsand expands CLI publish/build checks accordingly.
Reviewed changes
Copilot reviewed 6 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/web/src/components/Sidebar.tsx | Keeps a fixed-size favicon slot and overlays fallback/icon states. |
| apps/server/src/projectIconFallback.ts | Detects whether a project is Svelte/SvelteKit to choose an icon fallback. |
| apps/server/src/projectFaviconRoute.ts | Adds SvelteKit asset placeholder resolution and serves detected fallback SVGs. |
| apps/server/src/projectFaviconRoute.test.ts | Adds coverage for SvelteKit placeholder resolution and Svelte fallback selection. |
| apps/server/src/projectFaviconAssets.ts | Loads default + Svelte fallback SVG assets from assets/ at runtime. |
| apps/server/src/assets/project-favicons.af | Adds a large design/binary asset file to the repo. |
| apps/server/src/assets/project-favicon-svelte.svg | Adds the Svelte fallback SVG asset. |
| apps/server/src/assets/project-favicon-default.svg | Adds the default fallback SVG asset. |
| apps/server/scripts/cli.ts | Copies favicon SVG assets into dist/assets and verifies them during publish. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| function readSvgAsset(fileName: string): string { | ||
| return fs.readFileSync(path.join(ASSETS_DIR, fileName), "utf8"); | ||
| } | ||
|
|
||
| export const DEFAULT_PROJECT_FAVICON_SVG = readSvgAsset("project-favicon-default.svg"); | ||
| export const SVELTE_PROJECT_FAVICON_SVG = readSvgAsset("project-favicon-svelte.svg"); |
There was a problem hiding this comment.
readFileSync(...) at module import time will throw and crash the server process if the asset files are missing in the runtime filesystem (e.g., a build/publish pipeline forgets to copy dist/assets). Consider wrapping reads in a try/catch to throw a clearer error (including the expected path) or falling back to an inlined SVG string so the server can still boot.
There was a problem hiding this comment.
Fair, but we have a fallback on error
|
a bit out of scope, sorry |
Feat: Svelte favicon support
Solves #516
Implementation Prompt
Note
[!NOTE]
Add Svelte-specific favicon fallback and SvelteKit asset resolution to project favicon route
svelte.config.*,.svelte-kit/,src/app.html, orpackage.jsondependencies; when no favicon is found, the route now serves a Svelte-branded SVG for Svelte projects.src/app.htmlfor icon declarations and resolve%sveltekit.assets%/-prefixed hrefs by searching understatic/and the project root.src/assets/and reads them at module load time in projectFaviconAssets.ts; build and publish commands in cli.ts now copy these assets todist/assets/and assert their presence before publishing.Sidebar.ProjectFaviconto reset loading state whencwdchanges and show a folder icon on image load error.Macroscope summarized 90e3bc6.