Add patch for inflexible sveltejs-kit

This commit is contained in:
Djuri Baars 2023-11-17 19:10:46 +01:00
parent 6740030a0c
commit e14e85425e
5 changed files with 62 additions and 11 deletions

View file

@ -9,7 +9,8 @@
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .", "lint": "prettier --check . && eslint .",
"format": "prettier --write ." "format": "prettier --write .",
"postinstall": "patch-package"
}, },
"devDependencies": { "devDependencies": {
"@rollup/plugin-json": "^6.0.1", "@rollup/plugin-json": "^6.0.1",
@ -37,6 +38,7 @@
"@fontsource/oswald": "^5.0.17", "@fontsource/oswald": "^5.0.17",
"@fontsource/ubuntu": "^5.0.8", "@fontsource/ubuntu": "^5.0.8",
"bootstrap": "^5.3.2", "bootstrap": "^5.3.2",
"patch-package": "^8.0.0",
"svelte-i18n": "^4.0.0", "svelte-i18n": "^4.0.0",
"sveltestrap": "^5.11.2", "sveltestrap": "^5.11.2",
"swagger-ui": "^5.10.0" "swagger-ui": "^5.10.0"

View file

@ -0,0 +1,17 @@
diff --git a/node_modules/@sveltejs/kit/src/exports/vite/index.js b/node_modules/@sveltejs/kit/src/exports/vite/index.js
index a7a886d..d3433b5 100644
--- a/node_modules/@sveltejs/kit/src/exports/vite/index.js
+++ b/node_modules/@sveltejs/kit/src/exports/vite/index.js
@@ -561,9 +561,9 @@ function kit({ svelte_config }) {
input,
output: {
format: 'esm',
- entryFileNames: ssr ? '[name].js' : `${prefix}/[name].[hash].${ext}`,
- chunkFileNames: ssr ? 'chunks/[name].js' : `${prefix}/chunks/[name].[hash].${ext}`,
- assetFileNames: `${prefix}/assets/[name].[hash][extname]`,
+ entryFileNames: ssr ? '[name].js' : `${prefix}/[hash].${ext}`,
+ chunkFileNames: ssr ? 'chunks/[name].js' : `${prefix}/chunks/[hash].${ext}`,
+ assetFileNames: `${prefix}/assets/[hash][extname]`,
hoistTransitiveImports: false,
sourcemapIgnoreList
},

View file

@ -15,6 +15,7 @@
import { locale, locales, waitLocale } from 'svelte-i18n'; import { locale, locales, waitLocale } from 'svelte-i18n';
import type { LayoutLoad } from './$types'; import type { LayoutLoad } from './$types';
import { browser } from '$app/environment'; import { browser } from '$app/environment';
import { page } from '$app/stores';
export const setLocale = (lang: string) => () => { export const setLocale = (lang: string) => () => {
locale.set(lang); locale.set(lang);
@ -27,10 +28,10 @@
<Collapse navbar expand="md"> <Collapse navbar expand="md">
<Nav class="me-auto" navbar> <Nav class="me-auto" navbar>
<NavItem> <NavItem>
<NavLink href="/">Home</NavLink> <NavLink href="/" active="{$page.url.pathname === ("/")}">Home</NavLink>
</NavItem> </NavItem>
<NavItem> <NavItem>
<NavLink href="/api">API</NavLink> <NavLink href="/api" active="{$page.url.pathname === ("/api")}">API</NavLink>
</NavItem> </NavItem>
</Nav> </Nav>
<Dropdown inNavbar> <Dropdown inNavbar>

View file

@ -34,6 +34,10 @@
}); });
</script> </script>
<svelte:head>
<title>&#8383;TClock</title>
</svelte:head>
<Container fluid> <Container fluid>
<Row> <Row>
<Control bind:settings></Control> <Control bind:settings></Control>

View file

@ -4,21 +4,48 @@
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import * as swaggerJson from './swagger.json'; import * as swaggerJson from './swagger.json';
//import SwaggerUI from 'swagger-ui'; // import SwaggerUI from 'swagger-ui';
//import 'swagger-ui/dist/swagger-ui.css'; import 'swagger-ui/dist/swagger-ui.css';
onMount(async () => { onMount(async () => {
// SwaggerUI({ // @ts-ignore
// spec: swaggerJson, SwaggerUIBundle({
// dom_id: '#swagger-ui-container' spec: swaggerJson,
// }); dom_id: '#swagger-ui-container',
presets: [
// @ts-ignore
SwaggerUIBundle.presets.apis,
// @ts-ignore
SwaggerUIStandalonePreset
],
// layout: "StandaloneLayout",
});
}); });
</script> </script>
<svelte:head> <svelte:head>
<title>API playground</title> <title>API playground</title>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/5.10.0/swagger-ui-bundle.min.js"
integrity="sha512-Ckle4LZv9LhAfEdohBdUi+QCu0e7HkXHTeSPXfbDzbCsR87QNTUBylkBEPsBNn4Ph83yK1hJ6f2uH4QMtB0hTA=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/5.10.0/swagger-ui-standalone-preset.min.js"
integrity="sha512-qwGi7EG31HcylzamsmacHLZJrfUGRuuHEaCMcOojuNpMu+paR554VjaCZ9LdUVTrmF8xC03YVqTzuKx0SDdruA=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/5.10.0/swagger-ui.min.css"
integrity="sha512-Ck+X9SARG7WscOTG4a8Qod5Zgd1MZlz4VtyyucjMJ3PnZy2lUl7q/v/0055yIfGM/v+f+216ME0/dv0qqtm6+g=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
</svelte:head> </svelte:head>
<Container fluid> <Container fluid>
<div id="swagger-ui-container" /> <div id="swagger-ui-container" />
</Container> </Container>