refactor(proxy): change database driver packages to optional peer dependency#2388
refactor(proxy): change database driver packages to optional peer dependency#2388jiashengguo wants to merge 1 commit intodevfrom
Conversation
|
Claude finished @jiashengguo's task —— View job PR Review AnalysisI've completed my analysis of the refactor to make database driver packages optional peer dependencies. Todo List:
Summary of Changespackage.json: Added Code Review Feedback✅ Strengths
|
📝 WalkthroughWalkthroughThe pull request refactors database driver dependencies in the CLI package from required runtime dependencies to optional peer dependencies, with corresponding updates to dynamically import these drivers at runtime using proper error handling. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/cli/package.json`:
- Line 93: The file ends with a closing brace '}' but lacks a trailing newline;
update the packages/cli package.json by adding a single newline character after
the final '}' so the file ends with a POSIX-compliant trailing newline.
In `@packages/cli/src/actions/proxy.ts`:
- Around line 143-150: The catch blocks for dynamic imports (the SQLite import
assigning to SQLite: typeof BetterSqlite3 and the similar pg and mysql2 import
blocks) currently swallow all errors and always surface a "package missing"
CliError; change each catch to capture the error (e.g., catch (err)) and inspect
err.code (or err.message) — if it indicates module-not-found
(ERR_MODULE_NOT_FOUND / MODULE_NOT_FOUND) then throw the existing CliError
telling the user to install the package, otherwise rethrow the original error or
wrap it in a CliError that includes the original error message so native
addon/ABI failures are not misreported as "not installed". Ensure this change is
applied to the better-sqlite3, pg, and mysql2 dynamic import blocks.
Summary by CodeRabbit