Skip to content
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

support for Prisma 6 #2924

Merged
merged 1 commit into from
Dec 8, 2024
Merged

Conversation

vangie
Copy link
Contributor

@vangie vangie commented Dec 8, 2024

Information

Type Breaking change
Feature/Fix/Doc/Chore Yes/No

Todos

  • Tests
  • Coverage
  • Example
  • Documentation

Summary by CodeRabbit

  • New Features

    • Upgraded Prisma-related dependencies to the latest versions, enhancing compatibility and performance.
  • Refactor

    • Changed the import style for the @prisma/generator-helper module to improve code clarity while maintaining existing functionality.

Copy link

coderabbitai bot commented Dec 8, 2024

Walkthrough

The changes in this pull request involve updates to the package.json file for the @tsed/prisma package, focusing on upgrading several Prisma-related dependencies to version 6.0.1. Additionally, the import statement in the generator.ts file has been modified from a namespace import to a default import for the @prisma/generator-helper module. No alterations were made to the declarations of exported or public entities.

Changes

File Change Summary
packages/orm/prisma/package.json Updated dependencies: @prisma/generator-helper, @prisma/internals, @prisma/client, and prisma to version 6.0.1; updated peer dependency for @prisma/client to >=6.0.0.
packages/orm/prisma/src/generator.ts Changed import statement from namespace import to default import for @prisma/generator-helper.

Sequence Diagram(s)

sequenceDiagram
    participant A as User
    participant B as Generator
    participant C as Prisma Helper

    A->>B: Request generation
    B->>C: Call onManifest
    C-->>B: Return manifest
    B->>C: Call onGenerate
    C-->>B: Return generated output
    B-->>A: Return generation result
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between ee5d013 and 42dce51.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • packages/orm/prisma/package.json (2 hunks)
  • packages/orm/prisma/src/generator.ts (1 hunks)
🔇 Additional comments (3)
packages/orm/prisma/src/generator.ts (2)

2-2: Verify Prisma 6 generator helper compatibility

The import style change from namespace to default import suggests an API change in @prisma/[email protected]. Let's verify this change doesn't break functionality.

✅ Verification successful

Let me gather more information about the generator implementation to verify the import change compatibility.


Import change is safe and follows Prisma 6 patterns

The verification shows that:

  • The generator correctly uses generatorHandler from the imported helpers object
  • The codebase consistently uses DMMF types from @prisma/generator-helper across multiple files
  • The generator implementation follows the standard Prisma generator pattern with onManifest and onGenerate handlers
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the new import style is documented/required for Prisma 6

# Search for similar import patterns in the codebase
rg --type typescript "import.*@prisma/generator-helper"

# Check package.json files for other Prisma generators in the codebase
fd "package.json" | xargs rg "@prisma/generator-helper"

Length of output: 221


Script:

#!/bin/bash
# Search for the generator implementation to understand the usage
rg -t ts "import.*@prisma/generator-helper" -A 5

# Look for any generator handler implementation
ast-grep --pattern 'generatorHandler($_)'

# Check the actual file content
cat packages/orm/prisma/src/generator.ts

Length of output: 6774


Line range hint 11-17: Verify generator handler API compatibility

The generator handler implementation looks correct, but let's verify the API hasn't changed in Prisma 6.

✅ Verification successful

Let me gather more information about the generator handler API by checking the imports and dependencies.


Let me check the actual implementation and imports in the generator file to verify the API usage.


Generator handler implementation is compatible with Prisma 6

The implementation is correct and compatible with Prisma 6 based on the following evidence:

  • Package.json shows @prisma/generator-helper dependency is properly versioned to ^6.0.1
  • The generator handler implementation follows the correct API structure with required onManifest and onGenerate handlers
  • The manifest includes all required fields: defaultOutput, prettyName, and requiresGenerators
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any breaking changes in the generator handler API

# Search for any generator examples or tests
rg -A 5 "generatorHandler\(" 

# Look for migration guides or breaking changes
fd "CHANGELOG.md|BREAKING_CHANGES.md|MIGRATION.md"

Length of output: 462


Script:

#!/bin/bash
# Check imports and package.json for Prisma dependencies
rg -l "@prisma/generator-helper" 
cat packages/orm/prisma/package.json

# Look for generator handler usage patterns
ast-grep --pattern 'generatorHandler($$$)'

# Check for any test files that might show usage
fd -e test.ts -e spec.ts -X rg -l "generatorHandler"

Length of output: 2990


Script:

#!/bin/bash
# Check the generator implementation
cat packages/orm/prisma/src/generator.ts

# Look for any test files specifically in the prisma package
fd -e test.ts -e spec.ts -p "packages/orm/prisma"

Length of output: 1476

🧰 Tools
🪛 Biome (1.9.4)

[error] 3-3: A Node.js builtin module should be imported with the node: protocol.

Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.
Unsafe fix: Add the node: protocol.

(lint/style/useNodejsImportProtocol)

packages/orm/prisma/package.json (1)

Line range hint 24-31: Verify build scripts compatibility

The build scripts involve Prisma CLI commands. Let's verify they work with Prisma 6.

✅ Verification successful

Based on the shell script results, I can now generate the final response:

Build scripts are compatible with Prisma v6

The package.json shows that all Prisma dependencies are already aligned with v6:

  • @prisma/client: ^6.0.1
  • @prisma/generator-helper: ^6.0.1
  • @prisma/internals: ^6.0.1
  • prisma: ^6.0.1

The build and generate scripts use standard Prisma CLI commands that remain unchanged in v6:

  • prisma -v
  • prisma generate
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any Prisma CLI command changes in v6

# Search for Prisma CLI usage in scripts
rg "prisma" $(fd "package.json")

# Look for any Prisma-specific build or test scripts
fd "package.json" | xargs rg "\"(pre)?build\":|\"test\":|\"generate:.*\":" 

Length of output: 15707

Comment on lines +33 to +34
"@prisma/generator-helper": "^6.0.1",
"@prisma/internals": "^6.0.1",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider using stricter version ranges

Given this is a major version upgrade (Prisma 6), consider using stricter version ranges to prevent unexpected breaking changes.

-    "@prisma/generator-helper": "^6.0.1",
-    "@prisma/internals": "^6.0.1",
+    "@prisma/generator-helper": "~6.0.1",
+    "@prisma/internals": "~6.0.1",
-    "@prisma/client": "^6.0.1",
+    "@prisma/client": "~6.0.1",
-    "prisma": "^6.0.1",
+    "prisma": "~6.0.1",

Also applies to: 42-42, 53-53


💡 Codebase verification

Prisma dependencies are correctly updated, but test packages need attention

The main package has been properly updated to Prisma 6, but test packages are still using Prisma 4:

  • packages/orm/prisma/test/postgres-esm/package.json: prisma@^4.0.0, @prisma/client@^4.0.0
  • packages/orm/prisma/test/postgres/package.json: prisma@^4.0.0, @prisma/client@^4.0.0
  • packages/orm/prisma/test/mongo-esm/package.json: prisma@^4.0.0, @prisma/client@^4.0.0
  • packages/orm/prisma/test/mongo/package.json: prisma@^4.0.0, @prisma/client@^4.0.0
  • packages/orm/prisma/test/circular-ref/package.json: prisma@^4.0.0, @prisma/client@^4.0.0

These test packages should also be updated to Prisma 6 to ensure consistent testing environment.

🔗 Analysis chain

Verify Prisma 6 dependency compatibility

The Prisma dependencies have been consistently updated to version 6.0.1. However, let's verify:

  1. If all necessary Prisma-related dependencies are updated
  2. If the version ranges are appropriate
  3. If there are any known compatibility issues

Also applies to: 42-42, 53-53, 58-58

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for Prisma-related dependencies and version compatibility

# Search for any missed Prisma dependencies
rg "@prisma/" $(fd "package.json")

# Check for any transitive Prisma dependencies
rg "\"prisma\":" $(fd "package.json")

# Look for version constraints in other packages
fd "package.json" | xargs rg "@prisma|prisma"

Length of output: 10257

@Romakita Romakita merged commit 49428b3 into tsedio:production Dec 8, 2024
12 checks passed
@Romakita
Copy link
Collaborator

Romakita commented Dec 8, 2024

🎉 This PR is included in version 8.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Romakita
Copy link
Collaborator

Romakita commented Dec 8, 2024

@vangie thanks for the PR ;)
Please, next time, follow the commit naming convention. I forgot to check, but your commit was ignored by semantic release and doesn't appear on the release note :(

See you

@vangie
Copy link
Contributor Author

vangie commented Dec 9, 2024

@vangie thanks for the PR ;) Please, next time, follow the commit naming convention. I forgot to check, but your commit was ignored by semantic release and doesn't appear on the release note :(

See you

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants