Repository navigation
feat: copy fonts and nested assets from public/ to build - #3412
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe CLI public-file copy filter now uses an exported extension allowlist and directory-aware predicate. Tests cover allowed extensions, self-hosted fonts, case-insensitive matching, rejected filenames, nested copies, and stat failure handling. ChangesPublic file filtering
Estimated code review effort: 3 (Moderate) | ~15–30 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@packages/cli/src/utils/generate.ts`:
- Around line 230-239: Update the filter callback in copyPublicFiles so statSync
failures for individual entries are caught locally and cause only that entry to
be rejected. Preserve isPublicFileAllowed for successfully statted entries,
while ensuring copySync continues processing the remaining public files instead
of propagating the per-entry exception to the outer try/catch.
🪄 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: 8f261528-04aa-4a7a-bbb7-4dca9d641e17
📒 Files selected for processing (2)
packages/cli/src/utils/generate.test.tspackages/cli/src/utils/generate.ts
@faststore/api
@faststore/cli
@faststore/components
@faststore/core
@faststore/diagnostics
@faststore/lighthouse
@faststore/sdk
@faststore/ui
commit: |

What's the purpose of this pull request?
Stores couldn't self-host fonts:
.woff/.woff2files placed inpublic/were dropped during@faststore/cli's generate step and returned 404 in production. This blocks GDPR-sensitive (EU) stores and hurts Core Web Vitals, forcing merchants to inline fonts as base64.How it works?
copyPublicFilesinpackages/cli/src/utils/generate.tsused a fragile filter that matched extensions as a substring (endsWith) and cut whole subdirectories. It now:public/fonts/) are traversed instead of being skipped.path.extname().toLowerCase(), fixing false matches (e.g.basicomatchingico)..woff,.woff2,.ttf,.otf,.eot.The decision logic was extracted into a pure, exported
isPublicFileAllowed(src, isDirectory)and covered by unit tests.How to test it?
public/fonts/(e.g.public/fonts/inter.woff2) in a store..faststore/public/fonts/.pnpm turbo run test --filter=@faststore/cli.References
Summary by CodeRabbit
Bug Fixes
Tests