Skip to content

Reorganizing peers#2747

Merged
RobinTail merged 7 commits intomasterfrom
reorg-peers
Jun 15, 2025
Merged

Reorganizing peers#2747
RobinTail merged 7 commits intomasterfrom
reorg-peers

Conversation

@RobinTail
Copy link
Copy Markdown
Owner

@RobinTail RobinTail commented Jun 15, 2025

Addition to #2428

It turned out that required peer dependencies are installed automatically unless opted out:
https://pnpm.io/next/settings#autoinstallpeers

This might be a better solution since I want to absorb the validation workflow into the existing integration tests without hoisting

Discovered while working on #2736 and might be needed to solve in advance

Summary by CodeRabbit

  • Chores
    • Updated dependencies across multiple packages to use a centralized peer dependency catalog.
    • Added a new peer dependency catalog to the workspace configuration, listing key runtime and type definition packages.
    • Adjusted package dependencies to reference the new peer catalog, removing direct versioned dependencies where applicable.
    • Added or updated peer dependencies for packages such as zod and http-errors in relevant projects.

@RobinTail RobinTail added dependencies Pull requests that update a dependency file refactoring The better way to achieve the same result labels Jun 15, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 15, 2025

Warning

Rate limit exceeded

@RobinTail has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 22 minutes and 55 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between b586c1a and 39939bb.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • example/package.json (1 hunks)
  • issue952-test/package.json (1 hunks)
  • package.json (1 hunks)
  • tools/headers.ts (1 hunks)

"""

Walkthrough

This change updates multiple package.json files and the workspace configuration to centralize and standardize dependency version management using a new peer catalog. Dependencies and their type definitions are now referenced via the catalog, and redundant direct dependency declarations are removed or replaced accordingly.

Changes

Files/Groups Change Summary
cjs-test/package.json, esm-test/package.json Added zod as a dependency with version "catalog:peer"; added trailing commas to dependencies.
example/package.json Added http-errors and zod as dependencies and @types/http-errors as a devDependency, all as peers; changed undici version to "catalog:dev".
express-zod-api/package.json Changed all peer dependency version ranges to "catalog:peer"; changed undici devDependency to "catalog:dev".
issue952-test/package.json Replaced direct express and express-fileupload dependencies with their type definitions and added zod, all as "catalog:peer".
package.json Removed several devDependencies and their types; made typescript a peer dependency via the catalog; removed zod from devDependencies.
pnpm-workspace.yaml Introduced a catalogs section defining a peer catalog with explicit dependency version constraints, and a dev catalog for undici.

Sequence Diagram(s)

sequenceDiagram
    participant Package as Package (e.g., cjs-test)
    participant Catalog as Peer Catalog (pnpm-workspace.yaml)
    participant Dependency as Dependency (e.g., zod, express)
    
    Package->>Catalog: Requests dependency version (e.g., "zod": "catalog:peer")
    Catalog->>Dependency: Resolves to explicit version constraint
    Dependency-->>Package: Provides dependency at catalog-specified version
Loading

Possibly related PRs

  • Require minimum zod version 3.25.35 #2679: Updates the minimum required version of zod in express-zod-api/package.json, related to managing zod dependency versioning.
  • Using undici 7 #2622: Updates undici package version and Node.js engine requirement in express-zod-api/package.json, related to dependency version management.

Poem

In the warren of code, dependencies grew,
Now cataloged neatly, with versions anew.
Peer and type packages, all in a row,
Rabbits rejoice—what an organized show!
With catalog magic, the workspace is clear,
🐇 Hopping through modules, with nothing to fear!
Dependencies aligned, the path is bright,
Cataloged and tidy, a coder’s delight!
"""

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need 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)

  • @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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

@coveralls-official
Copy link
Copy Markdown

coveralls-official Bot commented Jun 15, 2025

Coverage Status

coverage: 100.0%. remained the same
when pulling 39939bb on reorg-peers
into a667f92 on master.

@RobinTail RobinTail marked this pull request as ready for review June 15, 2025 15:00
Copy link
Copy Markdown
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

🧹 Nitpick comments (1)
package.json (1)

35-35: Evaluate centralization of test tooling
vitest remains pinned directly—consider moving it into the peer catalog for consistency, or confirm this deviation is intentional.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a667f92 and e5576fb.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • cjs-test/package.json (1 hunks)
  • esm-test/package.json (1 hunks)
  • example/package.json (1 hunks)
  • express-zod-api/package.json (1 hunks)
  • issue952-test/package.json (1 hunks)
  • package.json (1 hunks)
  • pnpm-workspace.yaml (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
pnpm-workspace.yaml (1)
Learnt from: RobinTail
PR: RobinTail/express-zod-api#2428
File: express-zod-api/src/index.ts:44-44
Timestamp: 2025-05-28T18:58:10.064Z
Learning: The type-only import `import type {} from "qs";` in express-zod-api/src/index.ts is necessary to avoid TS2742 errors for exported functions like attachRouting, makeRequestMock, testEndpoint, and testMiddleware that have types depending on @types/qs. This import provides the reference TypeScript needs to infer portable type names.
cjs-test/package.json (1)
Learnt from: RobinTail
PR: RobinTail/express-zod-api#2697
File: CHANGELOG.md:5-5
Timestamp: 2025-06-02T21:08:56.475Z
Learning: The `cjs-test` directory in the express-zod-api repository is a test workspace and should be excluded when checking for main project version consistency with changelog entries.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: report
🔇 Additional comments (9)
pnpm-workspace.yaml (1)

18-29: Centralize peer dependency versions using pnpm catalogs.
The new catalogs.peer section correctly consolidates all peer dependency version constraints and aligns with the catalog:peer specifier in downstream package manifests. This will ensure consistent versions across workspaces.

esm-test/package.json (1)

10-11: Add zod as a peer catalog dependency.
Referencing zod via "catalog:peer" aligns this test workspace with the centralized version management defined in pnpm-workspace.yaml.

example/package.json (2)

17-19: Switch runtime dependencies to peer catalog references.
Replacing http-errors and zod with "catalog:peer" ensures example uses the shared peer versions.


22-22: Standardize @types/http-errors to peer catalog in devDependencies.
Referencing the types via "catalog:peer" keeps type versions in sync with the catalog.

cjs-test/package.json (1)

9-10: Add zod via peer catalog in CJS test workspace.
This aligns the CJS test environment with the centralized zod version.

express-zod-api/package.json (1)

69-78: Uniformize peer dependencies to use catalog:peer.
All peer dependencies now reference the centralized catalog entries, ensuring version consistency across the monorepo.

issue952-test/package.json (2)

10-11: Standardize type definitions as peer dependencies
Moving @types/express and @types/express-fileupload to the peer catalog centralizes version management and prevents drift.


13-13: Shift zod to peer catalog
Adding zod here aligns with the new catalog‐based approach. Confirm that autoinstallPeers is enabled so zod is installed automatically at runtime.

package.json (1)

33-33: Centralize TypeScript version in peer catalog
Switching typescript to "catalog:peer" is correct; verify that the peer catalog defines the desired TS version.

Comment thread package.json Outdated
Copy link
Copy Markdown
Owner Author

@RobinTail RobinTail left a comment

Choose a reason for hiding this comment

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

there is an issue on missing zod for headers tool

@RobinTail
Copy link
Copy Markdown
Owner Author

@coderabbitat review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 15, 2025

Tip

For best results, initiate chat on the files or code changes.

@RobinTail Great approach to centralizing dependency management! This PR effectively leverages pnpm's catalog feature to solve the peer dependency management challenges. Here's my review:

🎯 Overall Architecture

Excellent modernization! The catalog-based approach provides:

  • Single source of truth for all peer dependency versions
  • Automatic installation via pnpm's autoinstallpeers setting
  • Reduced duplication across package.json files
  • Better testing integration without hoisting complexity

📋 File-by-File Analysis

pnpm-workspace.yaml

The new catalogs section is well-structured:

catalogs:
  peer:
    "@types/compression": "^1.7.5"
    "@types/express": "^5.0.0"
    # ... other peer deps
  dev:
    undici: "^6.19.8"

Smart separation of peer vs dev dependencies.

express-zod-api/package.json

Clean transformation from explicit versions to catalog references:

"peerDependencies": {
  "@types/compression": "catalog:peer",
  "@types/express": "catalog:peer",
  // ...
}

Maintains all peer dependencies while centralizing version control.

Root package.json

Strategic removal of redundant devDependencies that are now peer-managed:

  • Removed: compression, express, http-errors, zod, etc.
  • These are now available via the peer catalog when needed

Test Package Files ✅

Consistent addition of required dependencies via catalog:

  • cjs-test & esm-test: Added zod as catalog:peer
  • issue952-test: Replaced direct deps with type definitions from catalog
  • example: Added http-errors, zod, and types via catalog

🚀 Benefits Realized

  1. Version Consistency: All packages use the same peer dependency versions
  2. Maintenance Simplification: Update versions in one place (the catalog)
  3. Testing Integration: Seamless dependency availability without hoisting
  4. Future-Proof: Leverages modern pnpm features for better workspace management

🎯 Alignment with Objectives

Perfect alignment with the stated goals:

  • ✅ Integrates validation workflow into integration tests
  • ✅ Avoids hoisting complexity
  • ✅ Prepares for issue Detaching migration #2736 resolution
  • ✅ Leverages pnpm's autoinstallpeers effectively

🔍 Minor Considerations

The changes look solid, but consider documenting this new dependency management approach in your README or contributing guidelines for future contributors.

This is a well-executed architectural improvement that should significantly streamline your dependency management! 🎉

Copy link
Copy Markdown
Owner Author

@RobinTail RobinTail left a comment

Choose a reason for hiding this comment

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

ok

@RobinTail RobinTail merged commit e56d0c7 into master Jun 15, 2025
15 checks passed
@RobinTail RobinTail deleted the reorg-peers branch June 15, 2025 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file refactoring The better way to achieve the same result

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant