Skip to content

feat: add support for pnpm catalogs #185

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
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

hacknug
Copy link

@hacknug hacknug commented Apr 23, 2025

πŸ”— Linked issue / Discussion

No issue opened. Change was small enough to PR directly.

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Currently, Nuxtr errors when using pnpm catalogs to manage nuxt's version.

This PR introduces a way for this extension to get the version number from pnpm-workspace.yaml using a regex to avoid adding any extra dependencies to the project.

This regex is extremely naive and doesn't check for the specific catalog where nuxt is supposed to be defined. Despite this it supports configs using simple, double or no quotes for the dependency name and version number (mix and match too). It also allows you to use anchors and aliases as long as a version number is specified in the nuxt line.

This is what my current config looks like and what I tested these changes with:

catalogs:
  nuxt:
    "nuxt": &nuxt "3.16.2"
    "@nuxt/kit": *nuxt
    "@nuxt/schema": *nuxt

Might be a good idea to add tests to ensure the regex works as expected in the future but since they're not set up in the project, we might tackle this in a separate PR if you want.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Not sure if this is something we would need to document since it is a change to an internal function.

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