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

SvelteKit: Automigration #20094

Merged
merged 23 commits into from
Dec 10, 2022
Merged

SvelteKit: Automigration #20094

merged 23 commits into from
Dec 10, 2022

Conversation

JReinhold
Copy link
Contributor

@JReinhold JReinhold commented Dec 5, 2022

This PR creates an automigration that handles migrating SvelteKit projects from an existing Svelte+Vite setup to the new SvelteKit Storybook framework.

It both migrates 6.x and 7.0 setups:

  • 7.0 framework: @storybook/svelte-vite
  • 6.x framework: @storybook/svelte + builder: @storybook/builder-vite
  • 6.x framework: @storybook/svelte + builder: storybook-builder-vite

Two other related changes:

  • A note is added to migrations about removing svelteOptions in most Vite-based projects.
  • Adding @storybook/svelte as a dependency to @storybook/sveltekit which is needed for some reason, even though it's transitive through @storybook/svelte-vite

@JReinhold JReinhold self-assigned this Dec 5, 2022
@JReinhold JReinhold added svelte maintenance User-facing maintenance tasks labels Dec 5, 2022
@JReinhold JReinhold marked this pull request as ready for review December 7, 2022 22:23
@JReinhold JReinhold requested review from shilman and IanVS December 7, 2022 22:24
@shilman
Copy link
Member

shilman commented Dec 9, 2022

Looking great! My primary concern from above is the @storybook/svelte removal.

const index = properties.findIndex(
(p) =>
(t.isIdentifier(p.key) && p.key.name === prop) ||
(t.isStringLiteral(p.key) && p.key.value === prop)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shilman we missed the fact that keys could be string literals ( { 'core': {...} } as opposed to { core: {...} }) which they were. Luckily my AST-fu has 10x today so I figured it out.

I'm sure there are other edge cases, but I think this is good for now.

Copy link
Member

Choose a reason for hiding this comment

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

Great job!! 💪

@JReinhold JReinhold requested a review from shilman December 9, 2022 20:54
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

Really nice one @JReinhold !! Bravo!! 👏

@shilman shilman added the cli label Dec 10, 2022
@shilman shilman merged commit c5ebb21 into next Dec 10, 2022
@shilman shilman deleted the jeppe/sveltekit-framework-automigration branch December 10, 2022 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli maintenance User-facing maintenance tasks svelte
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants