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

migrate to svelte 5 and update dependencies #130

Merged
merged 4 commits into from
Dec 13, 2024

Conversation

grmbyrn
Copy link
Collaborator

@grmbyrn grmbyrn commented Dec 12, 2024

  • Migrate from Svelte 4 to Svelte 5 as mentioned in this issue.
  • Update dependencies in package.json such as Vite which were preventing the successful migration to Svelte 5.
  • Upgrade ESLint to v9 as v8 has recently reached end of life and is no longer maintained, as mentioned here.
  • Upgrade Sass as current syntax is deprecated as mentioned here
  • Remove /contributors route as it is redundant since we now display GitHub contributors on home page and on Community page. Existing individual contributor pages have been retained and are accessible by clicking on the author's name in the blog post.
  • Remove Histoire as it doesn't support Vite at the minute. There is currently a PR open to fix this, so Histoire can be added back later if needed.
  • When navigating to a new page, the site wouldn't scroll up to the top as would be expected. As found here, this seems to be a Svelte issue. Solve this by adding the below code to the script block of routes/+layout.svelte and bind to page content:
import { onNavigate } from '$app/navigation';
let contentDiv: HTMLElement | null = null;

onNavigate((navigation) => {
    return new Promise((resolve) => {
	const transition = document.startViewTransition(async () => {
		if (contentDiv) {
			// Fix scroll
			contentDiv.scrollTop = 0;
		}
		resolve();
		await navigation.complete;
	});
    });
});

...

<div id="app-container">
    <Header />
    <div bind:this={contentDiv} class="content">
	{@render children?.()}
	<Footer />
    </div>
</div>

@grmbyrn grmbyrn requested a review from josecelano December 12, 2024 19:20
Copy link
Member

@josecelano josecelano left a comment

Choose a reason for hiding this comment

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

Great job @grmbyrn!

@josecelano
Copy link
Member

ACK 3f22176

@josecelano josecelano merged commit d5b55a4 into torrust:develop Dec 13, 2024
1 check passed
@da2ce7
Copy link
Contributor

da2ce7 commented Dec 13, 2024

Really Good Work @grmbyrn :)

@grmbyrn
Copy link
Collaborator Author

grmbyrn commented Dec 18, 2024

Great job @grmbyrn!

Thanks, @josecelano and @da2ce7 I appreciate it!

@grmbyrn grmbyrn deleted the svelte-5 branch December 18, 2024 14:41
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.

3 participants