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

chore: exclude IDE packages from regular build #1911

Merged
merged 3 commits into from
Dec 13, 2024
Merged

Conversation

ymc9
Copy link
Member

@ymc9 ymc9 commented Dec 13, 2024

No description provided.

Copy link
Contributor

coderabbitai bot commented Dec 13, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes in this pull request involve modifying the script/test-scaffold.ts file to update the npm command used for installing the zod package. The command now specifies a version range (zod@^3.22.4), ensuring that a compatible version of the package is installed. Additionally, the smartUnion function in packages/runtime/src/zod-utils.ts has been updated to use any types for parameters and return values, enhancing compatibility with different versions of the Zod library while reducing type safety. The overall structure and functionality of the scripts remain unchanged.

Changes

File Change Summary
script/test-scaffold.ts Updated npm command to install zod@^3.22.4 version.
packages/runtime/src/zod-utils.ts Modified smartUnion function to use any types for parameters and return values, simplifying type handling.

Possibly related PRs

  • chore: Prisma 5.22 support #1829: The changes in this PR also involve updating the version of the prisma and @prisma/client packages in the script/test-scaffold.ts file, similar to the main PR's update to the zod package version.
  • chore: bump prisma dependency to 6.0.x #1896: This PR modifies the version numbers of the prisma and @prisma/client packages in the same script/test-scaffold.ts file, indicating a related change in dependency management.

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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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 generate docstrings to generate docstrings for this PR. (Experiment)
  • @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
Contributor

@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: 0

🧹 Outside diff range and nitpick comments (1)
script/test-scaffold.ts (1)

22-22: LGTM! Version constraint for zod is appropriate.

The addition of ^3.22.4 for zod ensures consistent behavior across different environments while still allowing minor updates and patches.

Consider also adding version constraints for decimal.js and @types/node to ensure complete dependency predictability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c8b86f and 871e9b7.

⛔ Files ignored due to path filters (8)
  • .github/workflows/build-test.yml is excluded by !**/*.yml
  • package.json is excluded by !**/*.json
  • packages/plugins/openapi/package.json is excluded by !**/*.json
  • packages/plugins/trpc/package.json is excluded by !**/*.json
  • packages/plugins/trpc/tests/projects/nuxt-trpc-v10/package.json is excluded by !**/*.json
  • packages/plugins/trpc/tests/projects/nuxt-trpc-v11/package.json is excluded by !**/*.json
  • packages/plugins/trpc/tests/projects/t3-trpc-v10/package.json is excluded by !**/*.json
  • packages/plugins/trpc/tests/projects/t3-trpc-v11/package.json is excluded by !**/*.json
📒 Files selected for processing (1)
  • script/test-scaffold.ts (1 hunks)
🔇 Additional comments (1)
script/test-scaffold.ts (1)

22-22: Verify zod version compatibility and security.

Let's verify if this version of zod is appropriate and secure.

✅ Verification successful

Let me analyze the usage of zod in the codebase to ensure version compatibility. I'll check the specific zod features being used.


Version ^3.22.4 is appropriate and secure

The specified zod version (^3.22.4) is suitable because:

  • It's close to the latest version (3.24.1) and the caret range allows safe updates
  • The codebase consistently uses this version across multiple packages
  • The usage patterns show standard zod features (z.union, z.object, z.number, etc.) that are stable across 3.x versions
  • No breaking changes or security issues are reported between 3.22.4 and 3.24.1
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check zod version compatibility and security

# Check latest version from npm
echo "Latest zod version:"
npm view zod version

# Check for any security advisories
echo -e "\nSecurity advisories for zod:"
npm audit zod@^3.22.4 || true

# Check if any other files in the project use zod to verify compatibility
echo -e "\nFiles using zod:"
rg -l "from ['|\"]zod['|\"]" || true

Length of output: 1488


Script:

#!/bin/bash
# Check how zod is being used in the codebase to verify compatibility
echo "Checking zod usage patterns:"
rg "from ['|\"]zod['|\"]" -B 1 -A 3

# Check package.json files for any zod version constraints
echo -e "\nChecking package.json files for zod dependencies:"
fd package.json --exec cat {} | grep -A 1 -B 1 "zod"

Length of output: 10675

Copy link
Contributor

@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: 0

🧹 Outside diff range and nitpick comments (2)
packages/runtime/src/zod-utils.ts (2)

12-13: Documentation could be more specific about version compatibility.

While the added documentation explains the use of any, it would be helpful to specify which Zod versions this change aims to support.

Consider expanding the comment to include:

- * The function uses `any` for parameter and return type to be compatible with various zod versions.
+ * The function uses `any` for parameter and return type to be compatible with Zod versions ^3.22.4 and above,
+ * trading type safety for broader version compatibility.

31-33: Consider a more consistent type safety approach.

There's an inconsistency between using any in the function signature but maintaining specific Zod type assertions internally. Consider one of these approaches:

  1. Use type parameters to maintain type safety while ensuring version compatibility
  2. Document why specific type assertions are needed despite using any types

Here's a potential type-safe alternative using generics:

export function smartUnion<T extends Z.ZodTypeAny>(
  z: typeof Z,
  candidates: T[]
): Z.ZodType<T['_output']> {
  // ... rest of the implementation
}

Also applies to: 43-43

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 871e9b7 and 9a24d17.

📒 Files selected for processing (1)
  • packages/runtime/src/zod-utils.ts (3 hunks)
🔇 Additional comments (1)
packages/runtime/src/zod-utils.ts (1)

15-15: Verify if type relaxation is necessary for all supported Zod versions.

While using any types provides maximum compatibility, it significantly reduces type safety. Let's verify if this change is necessary for all supported Zod versions.

@ymc9 ymc9 merged commit 8d6a710 into dev Dec 13, 2024
13 checks passed
@ymc9 ymc9 deleted the chore/exclude-ide-build branch December 13, 2024 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant