-
-
Notifications
You must be signed in to change notification settings - Fork 117
fix: Update re-exports for new prisma-client generator #2184
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
fix: Update re-exports for new prisma-client generator #2184
Conversation
📝 WalkthroughWalkthroughThe update refactors the Changes
Possibly related PRs
Suggested reviewers
✨ 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Thanks for continuing to work on this @mhodgson . I feel this part of logic has become deeply entangled. It started when we introduced the logical client, and now with two flavors of generators 😂. I've decided to do a local refactor based on your PR. Will make the changes, test and merge then. |
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 (2)
tests/integration/tests/misc/prisma-client-generator.test.ts (2)
75-76
: Consider using template literals for better readability.The conditional imports work correctly but could be more readable using template literals.
-${config.isNewGenerator ? "import type { UserModel } from '" + config.modelsLoadPath + "';" : ''} +${config.isNewGenerator ? `import type { UserModel } from '${config.modelsLoadPath}';` : ''}-${config.isNewGenerator ? "const user1: UserModel = { id: 1, name: 'Alice', role: 'USER' };\nconsole.log(user1);" : ''} +${config.isNewGenerator ? `const user1: UserModel = { id: 1, name: 'Alice', role: 'USER' };\nconsole.log(user1);` : ''}Also applies to: 81-82
168-169
: Apply the same template literal improvement here for consistency.-${config.isNewGenerator ? "import type { UserModel } from '" + config.modelsLoadPath + "';" : ''} +${config.isNewGenerator ? `import type { UserModel } from '${config.modelsLoadPath}';` : ''}-${config.isNewGenerator ? "const user1: UserModel = { id: 1, name: 'Alice', role: 'USER' };\nconsole.log(user1);" : ''} +${config.isNewGenerator ? `const user1: UserModel = { id: 1, name: 'Alice', role: 'USER' };\nconsole.log(user1);` : ''}Also applies to: 174-175
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/schema/src/plugins/enhancer/enhance/index.ts
(6 hunks)packages/testtools/src/schema.ts
(3 hunks)tests/integration/tests/misc/prisma-client-generator.test.ts
(5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/schema/src/plugins/enhancer/enhance/index.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/testtools/src/schema.ts (3)
packages/runtime/src/enhancements/node/types.ts (1)
PolicyDef
(106-115)packages/runtime/src/constants.ts (1)
DEFAULT_RUNTIME_LOAD_PATH
(4-4)packages/runtime/src/types.ts (2)
AuthUser
(50-50)EnhancementOptions
(108-148)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: OSSAR-Scan
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: build-test (20.x)
- GitHub Check: build-test (20.x)
- GitHub Check: dependency-review
- GitHub Check: build-test (20.x)
🔇 Additional comments (6)
tests/integration/tests/misc/prisma-client-generator.test.ts (3)
3-25
: LGTM! Generator configurations are well-defined.The two generator configurations correctly represent the legacy "prisma-client-js" and new "prisma-client" generators with appropriate settings for testing.
27-48
: Well-structured test parameterization.The configuration objects clearly differentiate between the two generator types with appropriate load paths and options.
49-335
: Comprehensive test coverage for both generator types.The test suite thoroughly covers module exports, client extensions, auth functionality, and delegate models for both generator configurations. The use of
createProjectAndCompile
helper maintains consistency across tests.packages/testtools/src/schema.ts (3)
173-249
: Clean refactoring of loadSchema function.The separation of concerns between project compilation and runtime loading improves modularity and maintainability. The function correctly handles various configuration options including custom Prisma load paths and Pulse extension.
251-381
: Well-extracted project compilation logic.The
createProjectAndCompile
function effectively consolidates all project setup and compilation tasks. The extraction improves code organization and enables reuse.
363-363
: Good fix: Compilation now triggers when extra source files are provided.This change ensures that TypeScript compilation occurs whenever
extraSourceFiles
are provided, preventing potential runtime errors from uncompiled TypeScript files.
thanks! This looks great. |
This should update the re-exporting of the Prisma logical client when using the new
prisma-client
generator, consistent with discussions here