Skip to content

fix: reuse existing cataloged resolutions for consistency#8259

Merged
zkochan merged 2 commits intomainfrom
gluxon/catalog-reuse-prior-resolutions
Jun 30, 2024
Merged

fix: reuse existing cataloged resolutions for consistency#8259
zkochan merged 2 commits intomainfrom
gluxon/catalog-reuse-prior-resolutions

Conversation

@gluxon
Copy link
Member

@gluxon gluxon commented Jun 30, 2024

Context

In cases where multiple versions of a dependency are present in pnpm-lock.yaml, I believe users will expect dependencies using the catalog: protocol to all resolve to the same version.

In other words, a lockfile that looks like this would be surprising:

# pnpm-lock.yaml
importers:

  project1:
    dependencies:
      'is-positive':
        specifier: catalog:
        version: 3.0.0

  project3:
    dependencies:
      'is-positive':
        specifier: catalog:
        version: 3.1.0

Changes

If there's already a catalog resolution in the pnpm-lock.yaml file, use the version field.

# pnpm-lock.yaml
catalogs:
  default:
    'is-positive':
      specifier: ^3.0.0
      version: 3.0.0 # 👈 Pick this version when resolving.

@gluxon gluxon changed the title feat: reuse existing cataloged resolutions for consistency fix: reuse existing cataloged resolutions for consistency Jun 30, 2024
@gluxon gluxon force-pushed the gluxon/catalog-reuse-prior-resolutions branch from b8b3342 to cb5818c Compare June 30, 2024 14:37
@gluxon gluxon marked this pull request as ready for review June 30, 2024 14:41
@gluxon gluxon requested a review from zkochan as a code owner June 30, 2024 14:41
@gluxon gluxon force-pushed the gluxon/catalog-reuse-prior-resolutions branch from cb5818c to a871237 Compare June 30, 2024 14:52
@zkochan zkochan merged commit 6efda2e into main Jun 30, 2024
@zkochan zkochan deleted the gluxon/catalog-reuse-prior-resolutions branch June 30, 2024 23:58
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.

2 participants