tinyplex / tinybase

The reactive data store for local‑first apps.
https://tinybase.org
MIT License
3.39k stars 67 forks source link

Prettier peer dependency causes install errors #77

Closed selfagency closed 10 months ago

selfagency commented 11 months ago

Describe the bug

Appreciate your work on this. Ran into a weird issue, tho: The framework I'm using requires Prettier 3 for its internal eslint formatter but for some reason your package requires Prettier 2 as a peer dependency and therefore requires me to install packages with --legacy-peer-deps enabled. If you're not providing a language server to provide live code formatting in this package, could you not require that as a peer dep?

Thanks

❯ npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: tinybase@4.1.3
npm ERR! Found: prettier@3.0.3
npm ERR! node_modules/prettier
npm ERR!   dev prettier@"^3.0.3" from the root project
npm ERR!   peer prettier@">= 3.0.0" from @electron-toolkit/eslint-config-prettier@1.0.1
npm ERR!   node_modules/@electron-toolkit/eslint-config-prettier
npm ERR!     dev @electron-toolkit/eslint-config-prettier@"^1.0.1" from the root project
npm ERR!   3 more (eslint-plugin-prettier, prettier-plugin-svelte, prettier-plugin-tailwindcss)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peerOptional prettier@"^2.8.8" from tinybase@4.1.3
npm ERR! node_modules/tinybase
npm ERR!   dev tinybase@"^4.1.3" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: prettier@2.8.8
npm ERR! node_modules/prettier
npm ERR!   peerOptional prettier@"^2.8.8" from tinybase@4.1.3
npm ERR!   node_modules/tinybase
npm ERR!     dev tinybase@"^4.1.3" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /Users/daniel/.npm/_logs/2023-08-31T21_11_14_966Z-eresolve-report.txt

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

Create an Electron project using Svelte as your UI framework and add Tinybase.

Expected behavior

To not be forced to choose a linter version by my reactive store?

Screenshots or Videos

No response

Platform

Additional context

No response

jamesgpearce commented 11 months ago

We do actually use Prettier at "runtime" - or more precisely it is referenced in packaged code: the API generation tools prettify their output.

I can't roll to Prettier 3.0.0 because in turn I am waiting on https://github.com/mjeanroy/rollup-plugin-prettier/issues/1343

One good thing is that the tools will fail elegantly if Prettier is not present, BUT I think what might work here is that I keep my own devDependency version at ^2.8.8 and update the peerDependency to >2.8.8 (i.e. > rather than ^). Then you can have 3.0.3 locally no problem and yet TinyBase will still use 2.8.8 for itself.

New release 4.1.4 looks like it works!

jamesgpearce commented 10 months ago

I'm going to close this out, assuming it's good.

selfagency commented 10 months ago

working now, thanks