Skip to content

Commit

Permalink
Upgrade SvelteKit to version 2
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudlena committed Jan 15, 2024
1 parent ac35bd4 commit cb6e496
Show file tree
Hide file tree
Showing 13 changed files with 1,032 additions and 819 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @type { import("eslint").Linter.FlatConfig } */
module.exports = {
root: true,
extends: [
Expand Down
1,777 changes: 993 additions & 784 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@
"@floating-ui/dom": "^1.5.3",
"@fortawesome/free-brands-svg-icons": "^6.4.0",
"@fortawesome/free-solid-svg-icons": "^6.4.0",
"@skeletonlabs/skeleton": "^2.2.0",
"@skeletonlabs/tw-plugin": "^0.2.1",
"@sveltejs/adapter-static": "^2.0.0",
"@sveltejs/kit": "^1.20.4",
"@types/node": "^20.6.4",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"@skeletonlabs/skeleton": "^2.6.1",
"@skeletonlabs/tw-plugin": "^0.3.0",
"@sveltejs/adapter-static": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@types/node": "^20.10.6",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.28.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.30.0",
"postcss": "^8.4.30",
"prettier": "^3.0.0",
"prettier-plugin-svelte": "^3.0.0",
"svelte": "^4.0.5",
"svelte-check": "^3.4.3",
"svelte-fa": "^3.0.3",
"postcss": "^8.4.32",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"svelte": "^4.2.7",
"svelte-check": "^3.6.0",
"svelte-fa": "^4.0.1",
"svelte-i18n": "^4.0.0",
"svelte-markdown": "^0.4.0",
"tailwindcss": "^3.3.3",
"tailwindcss": "^3.4.0",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^4.4.2",
"vite-plugin-tailwind-purgecss": "^0.1.3"
"vite": "^5.0.3",
"vite-plugin-tailwind-purgecss": "^0.2.0"
},
"type": "module"
}
5 changes: 3 additions & 2 deletions src/lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { PUBLIC_SESSIONIZE_CLIENT_ID } from '$env/static/public';
import { error } from '@sveltejs/kit';
import type { NumericRange } from '@sveltejs/kit';
import { SessionGroupName } from '$lib/Session';
import type { Session, SessionGroup, GroupedSessions, Event } from '$lib/Session';
import type { Speaker, SpeakerDetails } from '$lib/Speaker';
Expand Down Expand Up @@ -85,8 +86,8 @@ async function get(fetchFn: typeof fetch, url: string) {
const res = await fetchFn(url);
const resBody = await res.json();

if (!res.ok) {
throw error(res.status, resBody.description);
if (!res.ok && res.status >= 400 && res.status <= 599) {
throw error(res.status as NumericRange<400, 599>, resBody.description);
}

return resBody;
Expand Down
6 changes: 3 additions & 3 deletions src/lib/locales/de.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/lib/locales/en.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/routes/+page.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as api from '$lib/api';
import type { PageLoad } from './$types';

export const load: PageLoad = ({ fetch }) => {
export const load: PageLoad = async ({ fetch }) => {
return {
sessions: api.getSessions(fetch),
speakers: api.getSpeakers(fetch)
sessions: await api.getSessions(fetch),
speakers: await api.getSpeakers(fetch)
};
};
2 changes: 1 addition & 1 deletion src/routes/schedule/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import type { PageLoad } from './$types';

export const load: PageLoad = async ({ fetch }) => {
return {
schedule: api.getSchedule(fetch)
schedule: await api.getSchedule(fetch)
};
};
2 changes: 1 addition & 1 deletion src/routes/sessions/[id]/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import type { PageLoad } from './$types';

export const load: PageLoad = async ({ fetch, params }) => {
return {
session: api.getSession(fetch, params.id)
session: await api.getSession(fetch, params.id)
};
};
4 changes: 2 additions & 2 deletions src/routes/speakers/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
switch (linkType) {
case LinkType.Twitter:
return faTwitter;
case LinkType.CompanyWebsite:
return faGlobe;
case LinkType.LinkedIn:
return faLinkedin;
default:
return faGlobe;
}
};
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/speakers/[id]/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import type { PageLoad } from './$types';

export const load: PageLoad = async ({ fetch, params }) => {
return {
speaker: api.getSpeaker(fetch, params.id)
speaker: await api.getSpeaker(fetch, params.id)
};
};
3 changes: 2 additions & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/kit/vite';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
const config = {
extensions: ['.svelte'],
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
"strict": true,
"moduleResolution": "bundler"
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//
Expand Down

0 comments on commit cb6e496

Please sign in to comment.