Skip to content

catalog in peerDependencies is not recognized #1604

@Mister-Hope

Description

@Mister-Hope

When running ncu -peer -w in a pnpm workspace, and the workspace packages contains peerDependencies with catalog: (it is supported by pnpm):

{
  // ...
  "peerDependencies": {
    "vuepress": "catalog:"
  }
}

An error is thrown and ncu process ends:

Upgrading /Users/mister-hope/projects/vuepress-ecosystem/plugins/development/plugin-toc/package.json
[====================] 2/2 100%
[====================] 2/2 100%
[====================] 1/1 100%
TypeError: Invalid comparator: catalog:
    at t.parse (/Users/mister-hope/projects/vuepress-ecosystem/node_modules/.pnpm/npm-check-updates@19.6.3/node_modules/npm-check-updates/build/index.js:59:20537)
    at new t (/Users/mister-hope/projects/vuepress-ecosystem/node_modules/.pnpm/npm-check-updates@19.6.3/node_modules/npm-check-updates/build/index.js:59:20340)
    at /Users/mister-hope/projects/vuepress-ecosystem/node_modules/.pnpm/npm-check-updates@19.6.3/node_modules/npm-check-updates/build/index.js:59:16558
    at Array.map (<anonymous>)
    at t.parseRange (/Users/mister-hope/projects/vuepress-ecosystem/node_modules/.pnpm/npm-check-updates@19.6.3/node_modules/npm-check-updates/build/index.js:59:16551)
    at /Users/mister-hope/projects/vuepress-ecosystem/node_modules/.pnpm/npm-check-updates@19.6.3/node_modules/npm-check-updates/build/index.js:59:15249
    at Array.map (<anonymous>)
    at new t (/Users/mister-hope/projects/vuepress-ecosystem/node_modules/.pnpm/npm-check-updates@19.6.3/node_modules/npm-check-updates/build/index.js:59:15237)
    at Object.Kl [as intersects] (/Users/mister-hope/projects/vuepress-ecosystem/node_modules/.pnpm/npm-check-updates@19.6.3/node_modules/npm-check-updates/build/index.js:59:24217)
    at /Users/mister-hope/projects/vuepress-ecosystem/node_modules/.pnpm/npm-check-updates@19.6.3/node_modules/npm-check-updates/build/index.js:806:4149

I think only a small change is needed for a fix. ncu can already recognize dependencies and devDependencies, it just needs to reuse the logic to skip it with peer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions