Skip to content
This repository was archived by the owner on Apr 19, 2025. It is now read-only.

Fixs for svelte4#574

Open
splimter wants to merge 31 commits into
bestguy:masterfrom
edraj:fix-svelte4
Open

Fixs for svelte4#574
splimter wants to merge 31 commits into
bestguy:masterfrom
edraj:fix-svelte4

Conversation

@splimter

@splimter splimter commented Oct 9, 2023

Copy link
Copy Markdown
  • Fixing Modal
  • Fixing the .d.ts files

@kefahi kefahi mentioned this pull request Oct 9, 2023
@LoopControl

Copy link
Copy Markdown

When I do npm install 'git+https://github.com/bestguy/sveltestrap.git#pull/574/head' to install from this pull request, I'm getting the following error:

npm ERR! Found: svelte@4.2.1
npm ERR! node_modules/svelte
npm ERR!   dev svelte@"^4.0.5" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer svelte@"^3.53.1" from sveltestrap@5.11.2
npm ERR! node_modules/sveltestrap
npm ERR!   sveltestrap@"git+https://github.com/bestguy/sveltestrap.git#pull/574/head" from the root project

Looks like this PR needs a package.json update to change the svelte dependency to 4.x?

@LoopControl

LoopControl commented Oct 11, 2023

Copy link
Copy Markdown

Still getting error after the 3 commits above. When I --force the install it works with this error:

npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: sveltestrap@5.11.2
npm WARN Found: svelte@4.2.1
npm WARN node_modules/svelte
npm WARN   peer svelte@"^3.54.0 || ^4.0.0-next.0" from @sveltejs/kit@1.25.0
npm WARN   node_modules/@sveltejs/kit
npm WARN     peer @sveltejs/kit@"^1.0.0" from @sveltejs/adapter-auto@2.1.0
npm WARN     node_modules/@sveltejs/adapter-auto
npm WARN     1 more (the root project)
npm WARN   9 more (@sveltejs/vite-plugin-svelte, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer svelte@"^3.53.1" from sveltestrap@5.11.2
npm WARN node_modules/sveltestrap
npm WARN   sveltestrap@"git+https://github.com/bestguy/sveltestrap.git#pull/574/head" from the root project
npm WARN 
npm WARN Conflicting peer dependency: svelte@3.59.2
npm WARN node_modules/svelte
npm WARN   peer svelte@"^3.53.1" from sveltestrap@5.11.2
npm WARN   node_modules/sveltestrap
npm WARN     sveltestrap@"git+https://github.com/bestguy/sveltestrap.git#pull/574/head" from the root project

@splimter

Copy link
Copy Markdown
Author

Hi @LoopControl thank you for checking our work.
Please try with --legacy-peer-deps, it did the trick for me.

@splimter

Copy link
Copy Markdown
Author

Hello @LoopControl please disregard my last message, and try again.

Comment thread svelte4fix.js Outdated
@@ -0,0 +1,49 @@
const { readdirSync, readFileSync, writeFileSync } = require("fs");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably don't need to check this file in

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@splimter just curious if you were aware of svelte-migrate which should migrate types. Was there something missing from it or a bug or anything like that?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @benmccann unfortunately no i was not aware of svelte-migrate.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@splimter do we need to consider svelte-migrate or is the necessary work already done?
Thanks!

@benmccann

Copy link
Copy Markdown
Contributor

Thanks for this!!

@milansimek

Copy link
Copy Markdown

@splimter I think the peer dependency version also needs to be updated in package.json?

Right now only v3 is added:

  "peerDependencies": {
    "svelte": "^3.53.1"
  },

Most likely it needs to be updated the same as the dev dependency?

"svelte": "^3.53.1 || ^4.2.1"

@milansimek

Copy link
Copy Markdown

@splimter Created pull request: https://github.com/edraj/sveltestrap/pull/1

Can confirm installing without --legacy-peer-deps works after this change

Update package.json peer deps Svelte 4.0.5
@kefahi

kefahi commented Oct 13, 2023

Copy link
Copy Markdown

Thank you @milansimek !

@splimter I have merged the pull request against our main PR.

Kindly let me know if there is any known issues left on this front. (e..g upgrading any other dependencies)

Comment thread package.json Outdated
},
"peerDependencies": {
"svelte": "^3.53.1"
"svelte": "^3.53.1 || ^4.0.5"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should leave support for Svelte 3 here. The type definitions are now using Svelte 4 types, which I don't think would be compatible. So this would only be compatible with Svelte 3 for users who aren't doing type checking. Also, there's no reason to require Svelte 4.0.5. Using any of the prior 4.x versions would be fine

Suggested change
"svelte": "^3.53.1 || ^4.0.5"
"svelte": "^4.0.0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benmccann Good point regarding removing Svelte 3 support 👍

Comment thread package.json Outdated
"sirv-cli": "^1.0.12",
"standard-version": "^9.3.0",
"svelte": "3.53.1",
"svelte": "^3.53.1 || ^4.0.5",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can let users install a wider range of dependencies in peerDependencies, but it probably makes sense for us to test against a more specific version

Suggested change
"svelte": "^3.53.1 || ^4.0.5",
"svelte": "^4.0.5",

@benmccann

Copy link
Copy Markdown
Contributor

Hmm. It looks like this project doesn't run the CI against PRs. Can you update the file in the .github directory to include the following?

on:
  push:
    branches:
      - master
  pull_request:

I suspect this PR will need some changes to avoid breaking the tests, but I can't tell if they're passing or not until we run them

@kefahi

kefahi commented Oct 14, 2023

Copy link
Copy Markdown

Hello @benmccann
Thank you for your input.
I made a number of changes and upgrades to make it work.
The CI now runs successfully.

@benmccann benmccann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This PR looks good to me now. I'd still recommend making the change I suggested earlier to when the GitHub workflow is triggered

@wilmardo

Copy link
Copy Markdown

Thanks for the work on this PR!
For me the modal isn't working yet, it shows up (better then the main branch). But it has no close icon and does not close when clicking next to the Modal.

image

Just my first Svelte project so I have no clue how to debug this further. I just copied the example Modal from the docs :)

@splimter

Copy link
Copy Markdown
Author

hi @wilmardo thanks for the feedback, please make sure that the toggle prop is on both Modal and ModalHeader, lemme know if that did solve your issue.

# Conflicts:
#	dist/sveltestrap.es.js
#	dist/sveltestrap.es.js.map
#	dist/sveltestrap.js
#	dist/sveltestrap.js.map
#	package-lock.json
#	package.json
@georgeemr

Copy link
Copy Markdown

Can confirm this works on my current project.

@SoyaNyan

Copy link
Copy Markdown

I've tested this PR from our Sveltekit (Svelte4) project and there is no issue related to both modal and offcanvas.
Have to test more for completely migrate, but still looks good to me.

@vdp641

vdp641 commented Nov 21, 2023

Copy link
Copy Markdown

Hi, how long this PR will be merged? The modal is currently not working. I cannot use sveltestrap with Svelte 4 on cloud CI/CD.
I only fixed it in local env but in the cloud it always gets the not-working version.

@splimter

Copy link
Copy Markdown
Author

Hello @vdp641 , what is the issue that you are facing with the modal.

@vdp641

vdp641 commented Nov 21, 2023

Copy link
Copy Markdown

@splimter hi, in the current version of sveltestrap, with Svelte 4, that does not fix the issue with global transition in Modal.svelte. It leads to Modal not opened.
This PR will fix this issue, but it has not been merged yet.

@dysfunc dysfunc mentioned this pull request Dec 15, 2023
59 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants