Skip to content

pnpm catalog support still incomplete #2107

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

Open
yanachuwan9sm opened this issue May 22, 2025 · 1 comment
Open

pnpm catalog support still incomplete #2107

yanachuwan9sm opened this issue May 22, 2025 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@yanachuwan9sm
Copy link

📋 Issue Description

Despite the fix in PR #1989 that was supposed to add support for pnpm catalogs, the functionality is still not working correctly due to a logical error in the conditional check.

🔍 Problem Analysis

The current code in the merged PR has a syntax error in the condition:

if (
  ![
    ...Object.entries(pkg.dependencies ?? {}),
    ...Object.entries(pkg.devDependencies ?? {}),
    ...Object.entries(pkg.peerDependencies ?? {}),
  ].some(([key]) => key.startsWith('catalog:'))
)

❌ Issue:
The variable key represents the package name, not the version. This means the condition key.startsWith('catalog:') will never be true since package names don't start with "catalog:", and the catalog replacement code is never executed.

✅ Proposed Solution
we need to check the value (version) instead of the key (package name):

if (
  ![
    ...Object.entries(pkg.dependencies ?? {}),
    ...Object.entries(pkg.devDependencies ?? {}),
    ...Object.entries(pkg.peerDependencies ?? {}),
  ].some(([key, value]) => value.startsWith('catalog:'))
)

🧪 Testing & Verification

I have tested this fix locally and confirmed that:

✅ Orval now correctly processes package.json files with pnpm catalog dependencies
✅ The catalog versions are properly resolved and replaced
✅ No errors occur when using dependencies like "@tanstack/react-query": "catalog:"

📝 Example

Before (broken):

{
  "dependencies": {
    "@tanstack/react-query": "catalog:"
  }
}

Results in: Error:

Invalid argument not valid semver ('catalog:' received)

After (fixed):

Works correctly and resolves catalog references.

🚀 Next Steps

If this analysis is correct and the proposed solution looks good, I'm ready to create a pull request with the fix.
This should be a minimal one-line change that resolves the remaining pnpm catalog compatibility issue.

@melloware
Copy link
Collaborator

please create a PR!

@melloware melloware added the bug Something isn't working label May 22, 2025
@melloware melloware added this to the 7.10.0 milestone May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants