roxiness / routify

Automated Svelte routes
https://routify.dev
1.88k stars 88 forks source link

Update peerDependencies to prevent `npm install` conflicts #551

Open yairkukielka opened 6 months ago

yairkukielka commented 6 months ago

Helllo! Would it be possible to update peerDependencies so we don't have to use the npm overrides field?

Using svelte 4 and vite 5 I'm getting these warnings when I run npm install:


npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @sveltejs/vite-plugin-svelte@2.5.3
npm WARN Found: vite@5.2.10
npm WARN node_modules/vite
npm WARN   dev vite@"^5.2.10" from the root project
npm WARN   5 more (@roxi/routify, @sveltejs/vite-plugin-svelte, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer vite@"^4.0.0" from @sveltejs/vite-plugin-svelte@2.5.3
npm WARN node_modules/@roxi/routify/node_modules/@sveltejs/vite-plugin-svelte
npm WARN   @sveltejs/vite-plugin-svelte@"^2.4.6" from @roxi/routify@3.0.0-next.223
npm WARN   node_modules/@roxi/routify
npm WARN   1 more (@sveltejs/vite-plugin-svelte-inspector)
npm WARN 
npm WARN Conflicting peer dependency: vite@4.5.3
npm WARN node_modules/vite
npm WARN   peer vite@"^4.0.0" from @sveltejs/vite-plugin-svelte@2.5.3
npm WARN   node_modules/@roxi/routify/node_modules/@sveltejs/vite-plugin-svelte
npm WARN     @sveltejs/vite-plugin-svelte@"^2.4.6" from @roxi/routify@3.0.0-next.223
npm WARN     node_modules/@roxi/routify
npm WARN     1 more (@sveltejs/vite-plugin-svelte-inspector)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @sveltejs/vite-plugin-svelte-inspector@1.0.4
npm WARN Found: vite@5.2.10
npm WARN node_modules/vite
npm WARN   dev vite@"^5.2.10" from the root project
npm WARN   5 more (@roxi/routify, @sveltejs/vite-plugin-svelte, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer vite@"^4.0.0" from @sveltejs/vite-plugin-svelte-inspector@1.0.4
npm WARN node_modules/@roxi/routify/node_modules/@sveltejs/vite-plugin-svelte/node_modules/@sveltejs/vite-plugin-svelte-inspector
npm WARN   @sveltejs/vite-plugin-svelte-inspector@"^1.0.4" from @sveltejs/vite-plugin-svelte@2.5.3
npm WARN 
npm WARN Conflicting peer dependency: vite@4.5.3
npm WARN node_modules/vite
npm WARN   peer vite@"^4.0.0" from @sveltejs/vite-plugin-svelte-inspector@1.0.4
npm WARN   node_modules/@roxi/routify/node_modules/@sveltejs/vite-plugin-svelte/node_modules/@sveltejs/vite-plugin-svelte-inspector
npm WARN     @sveltejs/vite-plugin-svelte-inspector@"^1.0.4" from @sveltejs/vite-plugin-svelte@2.5.3

I needed to add this section to my package.json to make npm happy:

        "@sveltejs/vite-plugin-svelte": "$@sveltejs/vite-plugin-svelte",
        "@roxi/routify": {
            ".": "$@roxi/routify",
            "vite": "$vite",
            "svelte": "$svelte"
        }

Also, in package.json I use "@sveltejs/vite-plugin-svelte": "^3.1.0", because it's imported by vite 5.

How to fix

I think if we add this to the "peerDepenencies" field in routify package.json it would get resolved:

    "peerDependencies": {
        "vite": "4 || 5",
        "svelte": ">=4",
        "@sveltejs/vite-plugin-svelte": ">=2"
    },
jakobrosenberg commented 6 months ago

Hi @yairkukielka , thanks for sharing this. Is this issue related to R2 or R3?

yairkukielka commented 6 months ago

R3

yairkukielka commented 6 months ago

Actually, we should probably just do

"peerDependencies": {
        "vite": "4 || 5",
        "svelte": "3 || 4",
        "@sveltejs/vite-plugin-svelte": ">=2"
    },

Since this package doesn't seem to work with Svelte 5 yet

jakobrosenberg commented 6 months ago

So far I'm only aware of one issue with Svelte 5. I don't know if it's a bug, but when passing data through <slot mydata="hello world" /> the passed mydata seems to be an empty store if nothing is passed.

I have a small fix for it, but it needs further investigation.

EDIT, this issue affects Routify itself and not just Routify projects as Routify uses slot properties internally.

yairkukielka commented 6 months ago

Hi, I added a separate issue for Svelte 5 support: https://github.com/roxiness/routify/issues/554

kefahi commented 4 weeks ago

Hello @jakobrosenberg Were you able to push that fix? Given that Svelte 5 was released recently, are there any remaining blockers from using roufity 3 with svelete 5? Thanks!

jakobrosenberg commented 2 weeks ago

@kefahi sorry about the slow reply.

The only blocker now is SSR/SSG. If you don't need server rendering, I'm not aware of any bugs.