Use invalidateAll and change some svelte/vite/ts configuration file

This commit is contained in:
andrea 2023-07-14 07:44:11 +02:00
parent 091429be58
commit 3c7413b799
4 changed files with 23 additions and 24 deletions

View file

@ -1,11 +1,11 @@
<script lang="ts"> <script lang="ts">
import QuizCard from "$lib/components/QuizCard.svelte" import QuizCard from "$lib/components/QuizCard.svelte"
import { EventsOn, LogDebug } from "$lib/wailsjs/runtime/runtime" import { EventsOn, LogDebug } from "$lib/wailsjs/runtime/runtime"
import { invalidateAll } from "$app/navigation"; import { invalidateAll } from "$app/navigation"
import { tick } from 'svelte'; import { tick } from 'svelte'
import { client } from "$lib/wailsjs/go/models" import { client } from "$lib/wailsjs/go/models"
import { QuizFromMarkdown, CreateQuiz } from "$lib/wailsjs/go/main/App" import { QuizFromMarkdown, CreateQuiz } from "$lib/wailsjs/go/main/App"
export let data; export let data;
let creatingNewQuiz: boolean let creatingNewQuiz: boolean
@ -21,7 +21,7 @@
} }
}) })
async function handleKeyDown(event) { async function handleKeyDown(event: any) {
if (event.key === 'Escape') { if (event.key === 'Escape') {
creatingNewQuiz = false; creatingNewQuiz = false;

View file

@ -3,21 +3,20 @@ import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/kit/vite'; import { vitePreprocess } from '@sveltejs/kit/vite';
/** @type {import('@sveltejs/kit').Config} */ /** @type {import('@sveltejs/kit').Config} */
const config = { const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors // Consult https://kit.svelte.dev/docs/integrations#preprocessors
// for more information about preprocessors // for more information about preprocessors
preprocess: vitePreprocess(), preprocess: vitePreprocess(),
vitePlugin: { vitePlugin: {
inspector: true, inspector: true,
}, },
kit: { kit: {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list. // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported or you settled on a specific environment, switch out the adapter. // If your environment is not supported or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters. // See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter({ adapter: adapter({
fallback: 'index.html' fallback: 'index.html'
}), })
files: { lib: './src/lib/' } }
}
}; };
export default config; export default config;

View file

@ -15,7 +15,7 @@
"$lib/*": ["./src/lib/*"], "$lib/*": ["./src/lib/*"],
// Adds the ability to import from the `frontend/` folder. // Adds the ability to import from the `frontend/` folder.
"@/*": ["./*"] // "@/*": ["./*"]
} }
} }
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias

View file

@ -1,12 +1,12 @@
import { sveltekit } from '@sveltejs/kit/vite'; import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config'; import { defineConfig } from 'vitest/config';
import path from 'path' // import path from 'path'
export default defineConfig({ export default defineConfig({
server: { server: {
fs: { fs: {
// Allow serving files from the frontend project root // Allow serving files from the frontend project root
allow: ['.'], // allow: ['.'],
}, },
}, },
resolve: { resolve: {
@ -14,7 +14,7 @@ export default defineConfig({
// This alias finishes the ability to reference our // This alias finishes the ability to reference our
// frontend/ with `@path/to/file`. // frontend/ with `@path/to/file`.
// //
'@': path.resolve(__dirname, './'), // '@': path.resolve(__dirname, './'),
}, },
}, },
plugins: [sveltekit()], plugins: [sveltekit()],