-
Notifications
You must be signed in to change notification settings - Fork 0
fix: 🐛 fix zipped templates not unzipped using bun #5
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
Conversation
📝 WalkthroughWalkthroughThis pull request adds runtime template extraction to address a Bun security policy issue that prevents postinstall scripts from executing. A new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/template.ts (1)
20-50: The zip structure concern is unfounded, but the validation robustness suggestion has merit.The
templates.zipis created byscripts/prepare.tsusingzip.addLocalFolder(templatesPath), which adds the contents of thetemplatesfolder (not the folder itself). This means the zip containsbackend/andmonorepo/at the root level, and extracting withextractAllTo(templatesPath, true)correctly producestemplates/backend/...andtemplates/monorepo/.... There is no risk of creating atemplates/templates/...structure.However, the validation improvement suggestion is valid. The current check at lines 41-43 only verifies that the
templatesPathdirectory exists, not that the expected template subdirectories (backendandmonorepo) were created. While the downstreamcopyRecursivecall would fail if the template subdirectory is missing, adding early validation as suggested would improve error clarity and fail fast:🔎 Suggested improvement for validation
if (!existsSync(templatesPath)) { throw new Error('Templates folder was not created after extraction'); } + + // Validate expected template directories exist + const expectedTemplates = ['backend', 'monorepo']; + const missingTemplates = expectedTemplates.filter( + (t) => !existsSync(join(templatesPath, t)) + ); + if (missingTemplates.length > 0) { + throw new Error( + `Missing template directories after extraction: ${missingTemplates.join(', ')}` + ); + }
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
CHANGELOG.mdsrc/template.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx}: Usebun <file>instead ofnode <file>orts-node <file>
Bun automatically loads .env files, so don't use the dotenv package
UseBun.serve()with built-in WebSocket, HTTPS, and route support instead ofexpress
Usebun:sqlitefor SQLite instead ofbetter-sqlite3
UseBun.redisfor Redis instead ofioredis
UseBun.sqlfor Postgres instead ofpgorpostgres.js
Use built-inWebSocketinstead ofwspackage
PreferBun.fileovernode:fsreadFile/writeFile for file operations
UseBun.$template literals for shell commands instead of execa
Files:
src/template.ts
**/*.{ts,tsx,css,html}
📄 CodeRabbit inference engine (CLAUDE.md)
Use
bun build <file.html|file.ts|file.css>instead ofwebpackoresbuild
Files:
src/template.ts
**/*.{html,ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use HTML imports with
Bun.serve()and don't usevitefor frontend bundling
Files:
src/template.ts
**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Use
bun --hot <file.ts>to run TypeScript files with hot module reloading enabled
Files:
src/template.ts
🧠 Learnings (1)
📚 Learning: 2026-01-03T07:00:32.832Z
Learnt from: truehazker
Repo: truehazker/create-elysiajs PR: 2
File: templates/backend:1-1
Timestamp: 2026-01-03T07:00:32.832Z
Learning: In git diffs, symlinks (mode 120000) appear as added files containing the link target (e.g., +monorepo/apps/backend). Do not flag symlinks as placeholder files or accidental commits. This applies broadly; when reviewing files like templates/backend, verify whether it is a symlink and treat accordingly.
Applied to files:
CHANGELOG.md
🔇 Additional comments (2)
CHANGELOG.md (1)
10-13: LGTM! Clear documentation of the fix.The changelog entries accurately describe the issue with Bun's default-secure lifecycle scripts policy and the solution using runtime template extraction.
src/template.ts (1)
65-66: LGTM! Correct placement of template extraction.The call to
ensureTemplatesExtracted()is correctly placed at the start ofsetupTemplate(), ensuring templates are available before they're accessed at line 68. The synchronous extraction is acceptable for a CLI tool, and the spinner provides user feedback during the operation.
Summary by CodeRabbit
bunx create-elywith Bun due to default-secure lifecycle scripts policy✏️ Tip: You can customize this high-level summary in your review settings.