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

Migration script #5773

Merged
merged 71 commits into from
Aug 4, 2022
Merged

Migration script #5773

merged 71 commits into from
Aug 4, 2022

Conversation

Rich-Harris
Copy link
Member

@Rich-Harris Rich-Harris commented Jul 31, 2022

This adds a new package, svelte-migrate, which will automate the automate-able bits of #5748:

npx svelte-migrate routes

It doesn't attempt to boil the ocean — it just moves files to their new homes and annotates the code with manual TODOs, which will be documented in a GitHub discussion.

(For clarity, we're doing the migration script first so we can dogfood it on our own apps and test suites, but we haven't implemented the changes yet, so don't get ahead of yourselves and run this on your own apps just yet!)

Bunch of stuff that still needs to happen:

  • fail gracefully when dealing with code that can't be parsed by TypeScript
  • add the documentation
  • inject errors into +page.server.js and +server.js telling people to update handler return values
  • inject errors into +page.js and +layout.js telling people to update load return values
  • inject error telling authors to replace multiple props with a single data prop
  • deal with the fact that +error can't have load, somehow
  • adjust imports in component code
  • replace ./__types/whatever with ./$types

@changeset-bot
Copy link

changeset-bot bot commented Jul 31, 2022

⚠️ No Changeset found

Latest commit: 813c9ed

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Rich-Harris
Copy link
Member Author

This is a bit loosey-goosey (I didn't add tests, on the basis that this is somewhat throwaway, but I could be persuaded of their value) but probably far enough along that we can start trying it out on codebases to see how far we get.

@Rich-Harris Rich-Harris marked this pull request as ready for review August 1, 2022 02:09
@Rich-Harris Rich-Harris mentioned this pull request Aug 1, 2022
16 tasks
…support server arrow function migration, extract migration into own file and add tests
@Rich-Harris
Copy link
Member Author

alright, time to give this a whirl

@Rich-Harris Rich-Harris merged commit 743f1c0 into master Aug 4, 2022
@Rich-Harris Rich-Harris deleted the migration-script branch August 4, 2022 17:45
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.

2 participants