nuxtr-vscode
nuxtr-vscode copied to clipboard
feat: add support for pnpm catalogs
๐ 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)
- [x] ๐ Bug fix (a non-breaking change that fixes an issue)
- [x] ๐ Enhancement (improving an existing functionality like performance)
- [x] โจ 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.