👽️ upgrade sveltekit

This commit is contained in:
James Walker 2022-11-12 20:58:29 -05:00
parent 97fccf5dab
commit 167022f587
Signed by: walkah
GPG Key ID: 3C127179D6086E93
9 changed files with 2395 additions and 4364 deletions

6691
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,11 +2,10 @@
"name": "scuff", "name": "scuff",
"version": "0.0.1", "version": "0.0.1",
"scripts": { "scripts": {
"dev": "svelte-kit dev", "dev": "vite dev",
"build": "svelte-kit build", "build": "vite build",
"package": "svelte-kit package", "package": "svelte-package",
"preview": "svelte-kit preview", "preview": "vite preview",
"prepare": "svelte-kit sync",
"test": "playwright test", "test": "playwright test",
"check": "svelte-check --tsconfig ./tsconfig.json", "check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch", "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
@ -17,6 +16,7 @@
"@playwright/test": "^1.21.0", "@playwright/test": "^1.21.0",
"@sveltejs/adapter-auto": "next", "@sveltejs/adapter-auto": "next",
"@sveltejs/kit": "next", "@sveltejs/kit": "next",
"@sveltejs/package": "^1.0.0-next.5",
"@typescript-eslint/eslint-plugin": "^5.10.1", "@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1", "@typescript-eslint/parser": "^5.10.1",
"autoprefixer": "^10.4.5", "autoprefixer": "^10.4.5",
@ -31,7 +31,10 @@
"svelte-preprocess": "^4.10.1", "svelte-preprocess": "^4.10.1",
"tailwindcss": "^3.0.24", "tailwindcss": "^3.0.24",
"tslib": "^2.3.1", "tslib": "^2.3.1",
"typescript": "~4.6.2" "typescript": "~4.8.4"
}, },
"type": "module" "type": "module",
"dependencies": {
"vite": "^3.2.3"
}
} }

View File

@ -3,11 +3,11 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="description" content="" /> <meta name="description" content="" />
<link rel="icon" href="%svelte.assets%/favicon.png" /> <link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
%svelte.head% %sveltekit.head%
</head> </head>
<body> <body data-sveltekit-prefetch>
<div>%svelte.body%</div> <div>%sveltekit.body%</div>
</body> </body>
</html> </html>

View File

@ -1,17 +1,16 @@
const verifyCredentials = async (instance: string, token: string) => {
const verifyCredentials = async(instance: string, token: string) => {
const url = `${instance}/api/v1/accounts/verify_credentials`; const url = `${instance}/api/v1/accounts/verify_credentials`;
const response = await fetch(url, { const response = await fetch(url, {
headers: { headers: {
Authorization: `Bearer ${token}` Authorization: `Bearer ${token}`
} }
}); });
return await response.json(); return await response.json();
} };
const user = { const user = {
verifyCredentials verifyCredentials
}; };
export default user; export default user;

View File

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import Login from '$components/Login.svelte'; import Login from '../components/Login.svelte';
</script> </script>
<svelte:head> <svelte:head>

View File

@ -1,6 +1,6 @@
import { writable } from 'svelte/store' import { writable } from 'svelte/store';
import type { Writable } from 'svelte/store' import type { Writable } from 'svelte/store';
export const userStore: Writable<object | null> = writable(null); export const userStore: Writable<object | null> = writable(null);
export const tokenStore: Writable<string | null> = writable(null); export const tokenStore: Writable<string | null> = writable(null);

View File

@ -1,6 +1,5 @@
import adapter from '@sveltejs/adapter-auto'; import adapter from '@sveltejs/adapter-auto';
import preprocess from 'svelte-preprocess'; import preprocess from 'svelte-preprocess';
import path from 'path';
/** @type {import('@sveltejs/kit').Config} */ /** @type {import('@sveltejs/kit').Config} */
const config = { const config = {
@ -9,14 +8,7 @@ const config = {
preprocess: preprocess(), preprocess: preprocess(),
kit: { kit: {
adapter: adapter(), adapter: adapter()
vite: {
resolve: {
alias: {
$components: path.resolve('./src/components')
}
}
}
} }
}; };

8
vite.config.ts Normal file
View File

@ -0,0 +1,8 @@
import { sveltekit } from '@sveltejs/kit/vite';
import type { UserConfig } from 'vite';
const config: UserConfig = {
plugins: [sveltekit()]
};
export default config;