Skip to content

svelte-package and PNPM workspace Catalogs: Invalid comparator: catalog: #12521

Closed

Description

@arkmech

Describe the bug

Using this pnpm workspace catalog feature in turborepo and svelte-package

https://pnpm.io/catalogs

Error: > Invalid comparator: catalog:

pnpm-workspace.yaml

catalog:
  eslint: ^9.7.0
  prettier: ^3.3.3
  typescript: ^5.5.3
  zod: ^3.23.8
  svelte: ^5.0.0-next.184
  tailwindcss: ^3.4.7

package.json

  "devDependencies": {
    "tailwindcss": "catalog:",
  },

Reproduction

Run svelte-package on svelte project that is using pnpm workspace catalog feature.

Logs

No response

System Info

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Max
    Memory: 625.48 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.15.1 - ~/.nvm/versions/node/v20.15.1/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v20.15.1/bin/npm
    pnpm: 9.6.0 - /opt/homebrew/bin/pnpm
    bun: 1.1.21 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 127.0.6533.72
    Safari: 17.5

Severity

blocking all usage of SvelteKit

Additional Information

No response

Activity

  1. arkmech commented on Jul 30, 2024

    @arkmech
    Author

    Relevant?: #12120

    Not sure how to use override feature.

  2. arkmech commented on Aug 16, 2024

    @arkmech
    Author

    Any update?

  3. arkmech commented on Sep 28, 2024

    @arkmech
    Author

    Ok, had time to do more digging: The issue is coming from semver which @sveltejs/package uses.

  4. arkmech commented on Sep 28, 2024

    @arkmech
    Author

    pnpm-workspace.yaml

    catalog:
      svelte: ^5.0.0-next.257
      "@sveltejs/kit": ^2.6.1
    
    catalogs:
      sveltetooling:
        "@sveltejs/adapter-auto": ^3.2.2
        "@sveltejs/adapter-node": ^5.2.4
        "@sveltejs/package": ^2.0.0
        "@sveltejs/vite-plugin-svelte": ^3.1.1
        vite-plugin-kit-routes: 0.6.11
        publint: 0.2.9
        svelte-check: ^3.8.4
        tslib: ^2.6.3
        vite: ^5.4.7

    Its specifically catalog: that doesn't work. but catalog:sveltetooling works.

    package.json

    {
      "name": "@company/ui",
      "version": "0.0.1",
      "private": true,
      "type": "module",
      "exports": {
      },
      "files": [
        "dist",
        "!dist/**/*.test.*",
        "!dist/**/*.spec.*"
      ],
      "scripts": {
        "dev": "vite dev --open",
        "build": "vite build && pnpm package",
        "clean": "rm -rf .turbo dist node_modules",
        "preview": "vite preview",
        "package": "svelte-kit sync && svelte-package && publint",
        "prepublishOnly": "npm run package",
        "format": "prettier --check . --ignore-path ../../.gitignore",
        "lint": "eslint",
        "test": "npm run test:integration && npm run test:unit",
        "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
        "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
        "test:integration": "playwright test",
        "test:unit": "vitest",
        "storybook": "storybook dev -p 6006",
        "build-storybook": "storybook build"
      },
      "dependencies": {
      },
      "devDependencies": {
        "@sveltejs/kit": "catalog:",
        "@sveltejs/package": "catalog:sveltetooling"
      },
    }
  5. arkmech commented on Sep 29, 2024

    @arkmech
    Author

    I ended up solving the issue: not sure why but it was essentially using "svelte": "catalog:" in peerDependencies doesn't work.

    It is only svelte in peerDependencies that causes the issue. I have to actually have an actual value in peerDependencies: "svelte": "5.0.0-next.260". Although any other package in peerDependencies with catalog: works...

    Deleted node_modules and did pnpm store prune and its only the svelte package.

    Based on pnpm docs apparently you can't use catalog: in peerDependencies...but its work for other packages.

    Only these are ok based on docs
    dependencies
    devDependencies
    optionalDependencies
    pnpm.overrides

  6. JamesHallowell commented on Feb 2, 2025

    @JamesHallowell

    It does appear that you can now use catalog: for peerDependencies:

    Image

    Is this something that svelte-package could support? It looks as though this is the part that doesn't work at the moment:

    const svelte_dep = pkg.peerDependencies?.svelte || pkg.dependencies?.svelte || '3.0';
    const no_svelte_3 = !semver.intersects(svelte_dep, '^3.0.0');

    I guess in the case of a catalog: dependency it would need to go and resolve the svelte version from the pnpm-workspace.yml file.

  7. schmittl commented on Jun 24, 2025

    @schmittl

    Seems like this could be fixed by #13850 already?

  8. added theissue type on Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions