Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixs for svelte4 #574

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open

Fixs for svelte4 #574

wants to merge 31 commits into from

Conversation

splimter
Copy link

@splimter splimter commented Oct 9, 2023

  • Fixing Modal
  • Fixing the .d.ts files

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

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: [email protected]
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 [email protected]
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
Copy link

LoopControl commented Oct 11, 2023

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: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/svelte
npm WARN   peer svelte@"^3.54.0 || ^4.0.0-next.0" from @sveltejs/[email protected]
npm WARN   node_modules/@sveltejs/kit
npm WARN     peer @sveltejs/kit@"^1.0.0" from @sveltejs/[email protected]
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 [email protected]
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: [email protected]
npm WARN node_modules/svelte
npm WARN   peer svelte@"^3.53.1" from [email protected]
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
Author

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

@splimter
Copy link
Author

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

svelte4fix.js Outdated
@@ -0,0 +1,49 @@
const { readdirSync, readFileSync, writeFileSync } = require("fs");
Copy link
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
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
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

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
Contributor

Thanks for this!!

@milansimek
Copy link

@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

@splimter Created pull request: edraj#1

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

Update package.json peer deps Svelte 4.0.5
@kefahi
Copy link

kefahi commented Oct 13, 2023

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)

package.json Outdated
@@ -31,7 +31,7 @@
"version": "npm run dist && npm run docs && git add -A"
},
"peerDependencies": {
"svelte": "^3.53.1"
"svelte": "^3.53.1 || ^4.0.5"
Copy link
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"

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 👍

package.json Outdated
@@ -84,9 +84,9 @@
"rollup-plugin-terser": "^7.0.2",
"sirv-cli": "^1.0.12",
"standard-version": "^9.3.0",
"svelte": "3.53.1",
"svelte": "^3.53.1 || ^4.0.5",
Copy link
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
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
Copy link

kefahi commented Oct 14, 2023

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

Copy link
Contributor

@benmccann benmccann left a comment

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

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
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

Can confirm this works on my current project.

@SoyaNyan
Copy link

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
Copy link

vdp641 commented Nov 21, 2023

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
Author

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

@vdp641
Copy link

vdp641 commented Nov 21, 2023

@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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants