Create apple-touch-icon if none exists#937
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughAdds sharp as an image-processing dependency and implements a compatibility path in Changes
Sequence Diagram(s)sequenceDiagram
participant Convert as convertMedia
participant FS as FileSystem
participant Sharp as sharp
participant Version as VersionCheck
Convert->>Version: check program version
Version-->>Convert: version < 13.4?
alt version < 13.4
Convert->>FS: stat `src/gen-assets/icons/apple-touch-icon.png`
FS-->>Convert: file exists? (no)
Convert->>FS: find Android icons (`icon-512.png`, `icon-192.png`, `icon-144.png`)
FS-->>Convert: return first match or none
alt found an Android icon
Convert->>Sharp: open & resize to 180x180
Sharp-->>Convert: resized image buffer
Convert->>FS: write `src/gen-assets/icons/apple-touch-icon.png`
FS-->>Convert: write complete
else none found
Convert-->>Convert: throw new Error("apple-touch-icon missing and no Android icon found")
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ 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: 3
🤖 Fix all issues with AI agents
In `@convert/convertMedia.ts`:
- Around line 163-165: Fix the typo in the inline comment inside the
version-check block that uses compareVersions(configData.data.programVersion!);
change the comment text from "app-touch-icon.png" to the correct
"apple-touch-icon.png" so the comment accurately describes the required file
referenced by src/routes/+layout.svelte.
- Around line 176-178: In convertMedia, the sharp(androidIcon).resize(180,
180).toFile(...) call is not awaited; update the convertMedia function to await
that Promise (or return it) so the file write completes before downstream tasks
and so errors surface as rejections from convertMedia; specifically locate the
sharp chain that writes 'apple-touch-icon.png' and prepend/handle with await and
propagate or catch/log the error appropriately.
- Around line 170-175: The current logic builds preferredAndroidIconSizes and
sets androidIcon by mapping to paths and using .find(...) ?? path.join(...
'icon-512.png'), which can still point to a non-existent file; change this to
capture the result of the .find into a variable (e.g., foundAndroidIcon) and if
it's undefined either skip icon generation/log a warning via your logger or
explicitly verify that path.join(androidIconFolder, 'icon-512.png') exists
before using it; update uses of androidIcon (in functions like convertMedia or
any call sites) to only proceed when a real file path was found, otherwise
return/skip the Android icon generation and emit a clear warning.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@convert/convertMedia.ts`:
- Around line 178-180: The code currently only throws when missing an Android
icon if the verbose flag is truthy (the "else if (verbose)" branch) causing
silent failures in quiet mode; change the conditional to an unconditional else
so the Error('No Android icon found to generate apple-touch-icon.png') is always
thrown when no source icon is available (replace "else if (verbose)" with "else"
in the block that throws), ensuring the conversion path in convertMedia.ts fails
fast and surfaces the missing-icon error.
dc081b7 to
4fadcfd
Compare
Summary by CodeRabbit
Bug Fixes
Chores