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

feat: preserve yaml anchors and aliases w/ single string value when updating pnpm-workspace.yaml #153

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

younggglcy
Copy link

Description

  1. PackageMeta, originally as an interface, is turned into a union type, and GlobalPackageMeta is exported
  2. since raw cannot provide more precise information, yaml's Document model is used to find anchors and aliases, thus js-yaml is dropped.

Linked Issues

fix #150

Additional context

Copy link
Member

@sxzz sxzz left a comment

Choose a reason for hiding this comment

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

Consider the use case below

defines:
  - &react ^18.2.0

catalog:
  react: *react
  react-dom: *react

It's not working in this PR.

src/io/pnpmWorkspaces.ts Outdated Show resolved Hide resolved
test/pnpmCatalog.test.ts Outdated Show resolved Hide resolved
test/pnpmCatalog.test.ts Outdated Show resolved Hide resolved
test/pnpmCatalog.test.ts Outdated Show resolved Hide resolved
test/pnpmCatalog.test.ts Outdated Show resolved Hide resolved
test/pnpmCatalog.test.ts Outdated Show resolved Hide resolved
@younggglcy
Copy link
Author

Consider the use case below

defines:
  - &react ^18.2.0

catalog:
  react: *react
  react-dom: *react

It's not working in this PR.

Thanks for the rapid reply❤️, but the test parts are not finished yet. Currently, the tests cannot
be passed locally, so there may be something wrong with mocking, I'll take my spare time to fix it.

And I'm wondering if we should support this use case, though this use case make sense, but it's not a valid yaml-schema for pnpm-workspace.yaml

younggglcy and others added 2 commits February 1, 2025 13:57
@sxzz
Copy link
Member

sxzz commented Feb 1, 2025

pnpm doesn't prohibit adding unknown fields. I'm not sure if this is a good use case, but my repository currently uses it this way.

@antfu antfu requested a review from sxzz February 3, 2025 04:44
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.

Feature: preserve yaml anchor and alias when bump pnpm catalog
2 participants