ueberdosis / tiptap

The headless rich text editor framework for web artisans.
https://tiptap.dev
MIT License
27.55k stars 2.29k forks source link

[Bug]: wrong peerDependencies resolving #5670

Closed chuuddo closed 1 month ago

chuuddo commented 1 month ago

Affected Packages

core, extension-heading, extension-link, extension-list-item, pm, starter-kit, vue-3

Version(s)

2.6.6

Bug Description

Installing these packages results in the message from npm "warn ERESOLVE overriding peer dependency"

npm i @tiptap/core@2.6.6 @tiptap/extension-heading@2.6.6 @tiptap/extension-link@2.6.6 @tiptap/extension-list-item@2.6.6 @tiptap/pm@2.6.6 @tiptap/starter-kit@2.6.6 @tiptap/vue-3@2.6.6 --save-exact
npm ls @tiptap/core
test-tiptap-install@1.0.0 /Users/ichudin/dev/test-tiptap-install
├── @tiptap/core@2.6.6
├─┬ @tiptap/extension-heading@2.6.6
│ └── @tiptap/core@2.6.6 deduped
├─┬ @tiptap/extension-link@2.6.6
│ └── @tiptap/core@2.6.6 deduped
├─┬ @tiptap/extension-list-item@2.6.6
│ └── @tiptap/core@2.6.6 deduped
├─┬ @tiptap/starter-kit@2.6.6
│ ├── @tiptap/core@2.7.4
│ ├─┬ @tiptap/extension-blockquote@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-bold@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-bullet-list@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-code-block@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-code@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-document@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-dropcursor@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-gapcursor@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-hard-break@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-history@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-horizontal-rule@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-italic@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-ordered-list@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-paragraph@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-strike@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ └─┬ @tiptap/extension-text@2.7.4
│   └── @tiptap/core@2.7.4 deduped
└─┬ @tiptap/vue-3@2.6.6
  ├── @tiptap/core@2.6.6 deduped
  ├─┬ @tiptap/extension-bubble-menu@2.7.4
  │ └── @tiptap/core@2.6.6 deduped invalid: "^2.7.0" from node_modules/@tiptap/vue-3/node_modules/@tiptap/extension-bubble-menu
  └─┬ @tiptap/extension-floating-menu@2.7.4
    └── @tiptap/core@2.6.6 deduped invalid: "^2.7.0" from node_modules/@tiptap/vue-3/node_modules/@tiptap/extension-bubble-menu, "^2.7.0" from node_modules/@tiptap/vue-3/node_modules/@tiptap/extension-floating-menu

npm error code ELSPROBLEMS
npm error invalid: @tiptap/core@2.6.6 /Users/ichudin/dev/test-tiptap-install/node_modules/@tiptap/core
npm ls @tiptap/pm
test-tiptap-install@1.0.0 /Users/ichudin/dev/test-tiptap-install
├─┬ @tiptap/core@2.6.6
│ └── @tiptap/pm@2.6.6 deduped
├─┬ @tiptap/extension-link@2.6.6
│ └── @tiptap/pm@2.6.6 deduped
├── @tiptap/pm@2.6.6
├─┬ @tiptap/starter-kit@2.6.6
│ ├─┬ @tiptap/core@2.7.4
│ │ └── @tiptap/pm@2.7.4 deduped
│ ├─┬ @tiptap/extension-code-block@2.7.4
│ │ └── @tiptap/pm@2.7.4 deduped
│ ├─┬ @tiptap/extension-dropcursor@2.7.4
│ │ └── @tiptap/pm@2.7.4 deduped
│ ├─┬ @tiptap/extension-gapcursor@2.7.4
│ │ └── @tiptap/pm@2.7.4 deduped
│ ├─┬ @tiptap/extension-history@2.7.4
│ │ └── @tiptap/pm@2.7.4 deduped
│ ├─┬ @tiptap/extension-horizontal-rule@2.7.4
│ │ └── @tiptap/pm@2.7.4 deduped
│ └── @tiptap/pm@2.7.4
└─┬ @tiptap/vue-3@2.6.6
  ├─┬ @tiptap/extension-bubble-menu@2.7.4
  │ └── @tiptap/pm@2.6.6 deduped invalid: "^2.7.0" from node_modules/@tiptap/vue-3/node_modules/@tiptap/extension-bubble-menu
  ├─┬ @tiptap/extension-floating-menu@2.7.4
  │ └── @tiptap/pm@2.6.6 deduped invalid: "^2.7.0" from node_modules/@tiptap/vue-3/node_modules/@tiptap/extension-bubble-menu, "^2.7.0" from node_modules/@tiptap/vue-3/node_modules/@tiptap/extension-floating-menu
  └── @tiptap/pm@2.6.6 deduped

npm error code ELSPROBLEMS
npm error invalid: @tiptap/pm@2.6.6 /Users/ichudin/dev/test-tiptap-install/node_modules/@tiptap/pm

Browser Used

Other

Code Example URL

No response

Expected Behavior

Expected that only one version(2.6.6) will be installed for @tiptap/core and @tiptap/pm.

Additional Context (Optional)

npm -v && node -v
10.8.3
v20.11.0

Dependency Updates

nperez0111 commented 1 month ago

So because each package has peer deps, if you do not specify every package in your package.json to be at a specific version this can happen. Like for example you are not using the bubble menu, but it is a peer dep of vue so it is resolving to a later version. The good thing is that all the packages should be interoperable, so it really isn't too much of a big deal in practice. But, to resolve them, you either need all the packages specified or for everything to be updated to the latest versions.

In Tiptap v3 we plan to drastically reduce the number of packages so that this would be much less of an issue for people

chuuddo commented 1 month ago

What about @tiptap/starter-kit? This package does not have any peerDependencies.

npm i @tiptap/core@2.6.6 @tiptap/extension-heading@2.6.6 @tiptap/extension-link@2.6.6 @tiptap/extension-list-item@2.6.6 @tiptap/pm@2.6.6 @tiptap/starter-kit@2.6.6 @tiptap/vue-3@2.6.6 @tiptap/extension-bubble-menu@2.6.6 @tiptap/extension-floating-menu@2.6.6 --save-exact

npm ls @tiptap/core
test-tiptap-install@1.0.0 /Users/ichudin/dev/test-tiptap-install
├── @tiptap/core@2.6.6
├─┬ @tiptap/extension-bubble-menu@2.6.6
│ └── @tiptap/core@2.6.6 deduped
├─┬ @tiptap/extension-floating-menu@2.6.6
│ └── @tiptap/core@2.6.6 deduped
├─┬ @tiptap/extension-heading@2.6.6
│ └── @tiptap/core@2.6.6 deduped
├─┬ @tiptap/extension-link@2.6.6
│ └── @tiptap/core@2.6.6 deduped
├─┬ @tiptap/extension-list-item@2.6.6
│ └── @tiptap/core@2.6.6 deduped
├─┬ @tiptap/starter-kit@2.6.6
│ ├── @tiptap/core@2.7.4
│ ├─┬ @tiptap/extension-blockquote@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-bold@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-bullet-list@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-code-block@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-code@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-document@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-dropcursor@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-gapcursor@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-hard-break@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-history@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-horizontal-rule@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-italic@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-ordered-list@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-paragraph@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ ├─┬ @tiptap/extension-strike@2.7.4
│ │ └── @tiptap/core@2.7.4 deduped
│ └─┬ @tiptap/extension-text@2.7.4
│   └── @tiptap/core@2.7.4 deduped
└─┬ @tiptap/vue-3@2.6.6
  └── @tiptap/core@2.6.6 deduped
nperez0111 commented 1 month ago

Ah, it specifies them as dependencies not peer deps: https://github.com/ueberdosis/tiptap/blob/6834a7f7d620c1706aaa5220db3ffcfebef946b7/packages/starter-kit/package.json#L31-L52

This isn't really a problem with Tiptap, it is how NPM resolution works

chuuddo commented 1 month ago

i think in this package dependencies should be without ^, except core and pm, they should be moved to peerDependencies

nperez0111 commented 1 month ago

I agree that core & pm should be peer deps in starter-kit.

But, starter-kit should not enforce exact dependencies (which is what removing ^ would do).

I could see an argument for allowing any version within the major version like 2.x

chuuddo commented 1 month ago

For example Storybook lock version in a similar package https://github.com/storybookjs/storybook/blob/next/code/addons/essentials/package.json#L91-L99

nperez0111 commented 1 month ago

They are using yarn so it is not really comparable.

Just fwiw, even if we change the versioning, you are still going to have this problem, you will need to update versions to get the change that is made. And like I said, we are reducing the number of packages with v3