-
Notifications
You must be signed in to change notification settings - Fork 141
refactor(frontend): make building icons process as one-time requirement #3776
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
base: main
Are you sure you want to change the base?
refactor(frontend): make building icons process as one-time requirement #3776
Conversation
|
🚅 Deployed to the rivet-pr-3776 environment in rivet-frontend
|
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
57840f4 to
d1ba806
Compare
Graphite Automations"Test" took an action on this PR • (01/07/26)1 assignee was added to this PR based on Kacper Wojciechowski's automation. |
d1ba806 to
9b5485b
Compare
PR Review: Refactor Frontend Icons Build ProcessSummaryThis PR refactors the @rivet-gg/icons package to move icon generation from a postinstall hook to a pre-commit vendoring process. Icons (including Font Awesome Pro) are now pre-generated and committed to the repository, eliminating the need for consumers to have a Font Awesome token. Strengths
Code Quality ObservationsGood Practices
Areas for Improvement1. Security Concern - Token Exposure The generated .npmrc file is properly gitignored, but consider adding verification that it is not being tracked before proceeding with script execution. 2. Missing Error Context (vendor-icons.js:177-190) When an icon does not exist, it silently falls back to faSquare. This could hide missing icons. Consider logging a warning when fallback occurs so maintainers know which icons failed to resolve. 3. Hardcoded Package Versions Package versions are duplicated in both scripts. Consider extracting to a shared config file to maintain DRY principle and prevent version mismatches. 4. Bundle Size Impact The PR adds 79,261 lines to dist/index.js (~104MB total additions). While necessary for pre-vendoring, consider:
5. Type Safety The @ts-nocheck disables all TypeScript checking. Consider converting to TypeScript for better maintainability or adding complete JSDoc types. 6. Missing Cleanup Both scripts create temporary files in src/ but do not clean them up. Consider cleanup after success or document why they are kept for caching. Testing Recommendations
Minor Issues
Performance ConsiderationsThe esbuild configuration looks solid with tree-shaking enabled, neutral platform, ESM format, and external peer dependencies properly configured. Security AssessmentLow Risk - The scripts only run with explicit maintainer action, require authentication token (not exposed in code), generate static files, and .npmrc is properly gitignored. Consider adding verification that .npmrc is not tracked before running. Overall AssessmentRecommendation: Approve with minor suggestions This is a well-executed refactor that significantly improves the developer experience. The code quality is good, with clear structure and helpful documentation. The main concerns are around error visibility (silent fallbacks) and repository size impact, but these are manageable. The legal licensing is properly handled, and the separation of manifest generation from vendoring is a good architectural choice. Priority Actions:
Great work on this refactor! |
9b5485b to
bf319ff
Compare
a6a5a7e to
04390c5
Compare
04390c5 to
c45896f
Compare
c45896f to
f8105a3
Compare
|
hey @copilot can you:
|
f8105a3 to
e258ec7
Compare
More templates
@rivetkit/cloudflare-workers
@rivetkit/db
@rivetkit/framework-base
@rivetkit/next-js
@rivetkit/react
rivetkit
@rivetkit/sql-loader
@rivetkit/virtual-websocket
@rivetkit/engine-runner
@rivetkit/engine-runner-protocol
commit: |
PR Review: refactor(frontend): make building icons process as one-time requirementOverviewThis PR refactors the @rivet-gg/icons package to pre-generate and commit all Font Awesome icons (including Pro icons) to the repository. This eliminates the need for consumers to have a Font Awesome Pro token. ✅ StrengthsArchitecture & Design
Code Quality
User Experience
🔍 Issues & Concerns1. Large Binary Files in Git (CRITICAL)The PR commits a 3.5MB dist/index.js file to git:
Problems: Bloats repository size permanently, every clone downloads this data, diffs are meaningless for generated code. Recommendations:
2. Missing Input ValidationLocation: shared-utils.js:83-87 The faCamelCase function lacks validation that str is defined. Could crash on edge cases. 3. Error Handling InconsistencyLocation: vendor-icons.js:240-243 Stack traces are lost in bundleWithEsbuild error handler. The pattern at vendor-icons.js:285-292 is correct - just inconsistent. 4. Security: Environment Variable Spreading (LOW)Location: shared-utils.js:143-147 The env: { ...process.env } spreads all environment variables into npm subprocess. Be explicit about which vars to pass (PATH, HOME, FONTAWESOME_PACKAGE_TOKEN). 5. Missing CleanupScripts create src/node_modules, src/.npmrc, src/package.json but never clean them up. Document cleanup process for maintainers. 6. TypeScript Type DefinitionsLocation: package.json:32 TypeScript expects .d.ts files, not .ts source files. This is unconventional and could cause issues. 7. Performance: O(n²) LoopsLocation: generate-manifest.js:83-107 Two-pass algorithm is fine for ~5000 icons but could be optimized with Map for O(1) lookups if icon count grows. 🎯 Testing RecommendationsMissing test coverage:
📊 Performance ConsiderationsPositive:
Concerns:
🔒 Security ReviewGood practices:
Minor concerns: See issue #4 above. 📝 Documentation SuggestionsAdd to CLAUDE.md:
✅ Checklist
🎬 RecommendationApprove with minor changes requested. The refactor is well-designed and significantly improves developer experience. Main concern is the large generated file in git. Priority actions:
The code quality is high and architectural improvements are significant. Great work! 🎉 Review completed by Claude Code 🤖 |
frontend/packages/icons/package.json
Outdated
| "vendor": "node scripts/vendor-icons.js", | ||
| "manifest": "node scripts/generate-manifest.js" |
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.
put this in to smth like gen:vendor and gen:manifest then add a gen script that does both
d1ef4ca to
00601f7
Compare
Pull Request Review: refactor(frontend): make building icons process as one-time requirementOverviewThis PR refactors the Rivet Icons package to vendor all Font Awesome icons (including Pro icons) directly into the repository. This is a significant architectural change that shifts from a build-time icon generation model to a pre-generated/committed model. Summary of ChangesProblem Solved: Previously, the icons package required each consumer to have Key Changes:
Code Quality Assessment✅ Strengths
|

No description provided.