-
Notifications
You must be signed in to change notification settings - Fork 1
Upgrade SvelteKit #57
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
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
647cba8
Upgrade SvelteKit to fix prefetching
AndrewLester 3ce286c
Update SvelteKit to most recent version
AndrewLester f402e2d
Update general config files
AndrewLester 90e185b
Replace globals.d.ts and separate app css and html
AndrewLester 0424b8f
Rename HTMLProps to HTMLAttributes in additionall svelte JSX
AndrewLester 249b6b0
Fix hooks import
AndrewLester 0b5b705
Don't use onClick prop instead forward click event
AndrewLester e8465b7
Refactor imports to reflect aliases and fix many types
AndrewLester 49c0182
Make work with us swap more explicit
AndrewLester 8d59b0b
Refactor load functions to use types
AndrewLester eeba23c
Fix some template type errors by using new svelte template tags
AndrewLester cc5e920
Add prepare script and fix formatting
AndrewLester 260cbf4
Set prerender default to true
AndrewLester cffee83
Replace navigation end event with afterNavigate lifecycle function
AndrewLester 8e61e4d
Remove some build steps by integrating 404 page and minification
AndrewLester e3e8157
Use any types without reducing safety elsewhere
AndrewLester e65e7f7
Upgrade eslint plugin
AndrewLester c42d4dd
Split build script into post build
AndrewLester 2634936
Only run ackee if variables exist
AndrewLester 78ae77b
Fix refetch of layout
AndrewLester c700407
Fix svelte:head swapping
AndrewLester 74aeab6
Revert separation of css from app.html and create root layout
AndrewLester 663f29b
Fix intersection observer and api client typing with same structure
AndrewLester 2e48a60
Fix format
AndrewLester 23a337a
Upgrade SvelteKit again
AndrewLester cc208de
Set preview port to 3000
AndrewLester e1d6c3b
Use SvelteKit dev variable for prod check
AndrewLester 37d4d24
Fix 404 page not showing up
AndrewLester f167e32
Update readme for SvelteKit clarification
AndrewLester 7ee7e5a
Remove ambient ts
AndrewLester 29d2cd6
Revert "Remove ambient ts"
AndrewLester File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "singleQuote": false, | ||
| "trailingComma": "es5", | ||
| "printWidth": 80 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| declare namespace svelte.JSX { | ||
| interface HTMLProps<T> { | ||
| interface HTMLAttributes<T> { | ||
| onenterViewport?: () => void; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /// <reference types="@sveltejs/kit" /> | ||
|
|
||
| // See https://kit.svelte.dev/docs/types#app | ||
| // for information about these interfaces | ||
| // and what to do when importing types | ||
| declare namespace App { | ||
| // interface Locals {} | ||
| // interface Platform {} | ||
| // interface Session {} | ||
| // interface Stuff {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,31 @@ | ||
| <script lang="ts"> | ||
| import { onMount } from "svelte"; | ||
|
|
||
| export let title: string; | ||
| export let description: string; | ||
| export let url: string; | ||
| export let image: string | undefined; | ||
|
|
||
| onMount(() => (document.title = title)); | ||
| </script> | ||
|
|
||
| <title>{title}</title> | ||
| <meta name="description" content={description} /> | ||
| <svelte:head> | ||
| <title>{title}</title> | ||
| <meta name="description" content={description} /> | ||
|
|
||
| <meta property="og:type" content="website" /> | ||
| <meta property="og:title" content={title} /> | ||
| <meta property="og:description" content={description} /> | ||
| <meta property="og:url" content={url} /> | ||
| <meta property="og:type" content="website" /> | ||
| <meta property="og:title" content={title} /> | ||
| <meta property="og:description" content={description} /> | ||
| <meta property="og:url" content={url} /> | ||
|
|
||
| <meta name="twitter:domain" value="https://uiuc.hack4impact.org" /> | ||
| <meta name="twitter:title" content={title} /> | ||
| <meta name="twitter:description" content={description} /> | ||
| <meta name="twitter:url" content={url} /> | ||
| <meta name="twitter:domain" value="https://uiuc.hack4impact.org" /> | ||
| <meta name="twitter:title" content={title} /> | ||
| <meta name="twitter:description" content={description} /> | ||
| <meta name="twitter:url" content={url} /> | ||
|
|
||
| <meta | ||
| name="twitter:card" | ||
| content={image !== undefined ? "summary_large_image" : "summary"} | ||
| /> | ||
| <meta | ||
| name="twitter:card" | ||
| content={image !== undefined ? "summary_large_image" : "summary"} | ||
| /> | ||
|
|
||
| {#if image !== undefined} | ||
| <meta property="og:image" content={image} /> | ||
| <meta name="twitter:image" content={image} /> | ||
| {/if} | ||
| {#if image !== undefined} | ||
| <meta property="og:image" content={image} /> | ||
| <meta name="twitter:image" content={image} /> | ||
| {/if} | ||
| </svelte:head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,43 @@ | ||
| import dotenv from "dotenv"; | ||
| import { ContentWrapper } from "./utils/api"; | ||
| import { ContentWrapper } from "$utils/api"; | ||
| import { minify, type Options } from "html-minifier-terser"; | ||
| import { prerendering } from "$app/env"; | ||
| import type { Handle } from "@sveltejs/kit"; | ||
|
|
||
| dotenv.config(); | ||
|
|
||
| const { CONTENTFUL_DELIVERY_KEY, CONTENTFUL_SPACE_ID } = process.env; | ||
|
|
||
| const contentWrapper = new ContentWrapper( | ||
| CONTENTFUL_SPACE_ID, | ||
| CONTENTFUL_DELIVERY_KEY | ||
| export const contentWrapper = new ContentWrapper( | ||
| CONTENTFUL_SPACE_ID!, | ||
| CONTENTFUL_DELIVERY_KEY! | ||
| ); | ||
|
|
||
| export { contentWrapper }; | ||
| const minificationOptions: Options = { | ||
| collapseBooleanAttributes: true, | ||
| collapseWhitespace: true, | ||
| minifyCSS: true, | ||
| minifyJS: true, | ||
| removeComments: true, | ||
| removeOptionalTags: true, | ||
| removeRedundantAttributes: true, | ||
| removeScriptTypeAttributes: true, | ||
| removeTagWhitespace: true, | ||
| useShortDoctype: true, | ||
| }; | ||
|
|
||
| export const handle: Handle = async ({ event, resolve }) => { | ||
| const response = await resolve(event); | ||
|
|
||
| if (prerendering && response.headers.get("content-type") === "text/html") { | ||
| return new Response( | ||
| await minify(await response.text(), minificationOptions), | ||
| { | ||
| status: response.status, | ||
| headers: response.headers, | ||
| } | ||
| ); | ||
| } | ||
|
|
||
| return response; | ||
| }; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.