feat(update-deps): resolve pnpm catalog specs and expand workspace patterns like pnpm - #15
Merged
Merged
Conversation
…tterns like pnpm Cataloged deps bump their pnpm-workspace.yaml entry (one line rewritten, comments intact), are reported once per catalog entry, and a missing catalog entry now warns instead of passing silently. Workspace patterns expand with pnpm semantics so interior * segments are no longer invisible.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
update-depscompared each manifest spec as a semver range, so"typescript": "catalog:"had nothing to parse and was skipped — silently, with a green nightly job. Any repo that migrated to a pnpm catalog would freeze every cataloged dependency at its catalog version while still reporting success. This teachesupdate-depsabout catalogs and fixes the pattern expander that hid interior-*manifests. Unblocks constructive-io/constructive-planning#1764 (the constructive-db catalog migration, 221 manifests); the point is that a cataloged dep must never silently stop being updated.Catalogs (
src/commands/catalogs.ts, wired intoupdateDeps):The catalog spec is what gets compared, and the bump is written to the catalog entry in
pnpm-workspace.yaml, not to the manifest.setCatalogSpecrewrites the single line holding the entry (locating it by indentation), so the rest of the file — comments, quoting style, trailing# ...on the entry line — is byte-identical; constructive-db's catalog is heavily commented. Flow-style catalogs (catalog: { ts: ^5.6.3 }) fall back to ayamldocument edit, which still keeps comments but may reformat.Reporting is deduped per catalog entry, keyed
catalog + depName, so a dep cataloged once is reported and bumped once instead of once per consuming manifest:{ "name": "typescript", "currentVersion": "^5.6.3", "consumer": "catalog:", "file": "pnpm-workspace.yaml", "catalog": "default", "outdated": true }workspace:specs keep being skipped, unchanged.Choice for manifest-level overrides: a manifest that pins an explicit range instead of using the catalog is bumped in place, and stays an explicit range. It's a deliberate override, and it's still a version we own, so leaving it to drift would recreate the very failure this PR fixes on a per-manifest scale. It takes the normal (unchanged) manifest path; the catalog entry is untouched by it.
No more silent success: the result gains
warnings: string[]. A manifest asking forcatalog:for a dep with no catalog entry (typo, or a rename) now produces a warning rather than a skip.Pattern expansion (
src/commands/workspacePatterns.ts, shared byupdateDepsandupdateWorkspace): the old glob wasp.replace(/\/?\*\*?$/, '') + '/*/package.json', which appends a level that pnpm doesn't, so a pattern ending in a literal segment matched the wrong depth:That invisibility is what let dependency drift into a constructive-db manifest that makage never rewrote.
Release note for the constructive-db side
This ships in a new
makageversion — the catalog migration must consume a published makage (or the CI workflow must pin this commit) before it lands, otherwise the migration silently disables updates for everything it touches.makageis published frompackages/makage/dist; this PR does not bump the version (releases go through the repo's usualchore(release): publishflow).Tests
packages/makage/__tests__/catalogs.test.ts(spec parsing, default/named/catalogs.defaultprecedence, single-line surgical rewrite with comments and quoting preserved, flow-style fallback),workspacePatterns.test.ts(pattern→glob mapping plus a real-filesystem expansion offunctions/*/handlers/*andfunctions/*/pages, node_modules and!exclusions), and apnpm catalogsblock inupdateDeps.test.ts(catalog bumped inpnpm-workspace.yamland deduped across consumers, named catalogs, override bumped in place with the catalog untouched,workspace:still skipped,--dry-runwrites nothing, missing catalog entry warns). Also verified end-to-end with the built CLI against a throwaway workspace.pnpm test(56 passing),pnpm lint,pnpm buildall clean.Link to Devin session: https://app.devin.ai/sessions/7e055fec09f94bd19765ac4c961d5920
Requested by: @pyramation