Skeleton for a yaml config.

This commit is contained in:
2023-08-11 09:51:33 +02:00
parent 052f3b71bf
commit 931783245c
8 changed files with 117 additions and 6 deletions

View File

@@ -5,6 +5,5 @@
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }],
"tabWidth": 4
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}

52
package-lock.json generated
View File

@@ -8,6 +8,7 @@
"name": "flanders",
"version": "0.0.1",
"devDependencies": {
"@modyfi/vite-plugin-yaml": "^1.0.4",
"@playwright/test": "^1.28.1",
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.20.4",
@@ -549,6 +550,20 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
"node_modules/@modyfi/vite-plugin-yaml": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@modyfi/vite-plugin-yaml/-/vite-plugin-yaml-1.0.4.tgz",
"integrity": "sha512-qkT0KiR3AQQRfUvDzLv4+1rYAzXj+QmGhAbyUd0Ordf9xynK76i758lk5GiEfxuQxbvdqDaJ9oXkH/KacbSjQQ==",
"dev": true,
"dependencies": {
"@rollup/pluginutils": "5.0.2",
"js-yaml": "4.1.0",
"tosource": "2.0.0-alpha.3"
},
"peerDependencies": {
"vite": "^2.6.0 || ^3.0.0 || ^4.0.0"
}
},
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -609,6 +624,34 @@
"integrity": "sha512-a5Sab1C4/icpTZVzZc5Ghpz88yQtGOyNqYXcZgOssB2uuAr+wF/MvN6bgtW32q7HHrvBki+BsZ0OuNv6EV3K9g==",
"dev": true
},
"node_modules/@rollup/pluginutils": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.2.tgz",
"integrity": "sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==",
"dev": true,
"dependencies": {
"@types/estree": "^1.0.0",
"estree-walker": "^2.0.2",
"picomatch": "^2.3.1"
},
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0||^3.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
}
},
"node_modules/@rollup/pluginutils/node_modules/estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
"dev": true
},
"node_modules/@sinclair/typebox": {
"version": "0.27.8",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
@@ -3347,6 +3390,15 @@
"node": ">=8.0"
}
},
"node_modules/tosource": {
"version": "2.0.0-alpha.3",
"resolved": "https://registry.npmjs.org/tosource/-/tosource-2.0.0-alpha.3.tgz",
"integrity": "sha512-KAB2lrSS48y91MzFPFuDg4hLbvDiyTjOVgaK7Erw+5AmZXNq4sFRVn8r6yxSLuNs15PaokrDRpS61ERY9uZOug==",
"dev": true,
"engines": {
"node": ">=10"
}
},
"node_modules/totalist": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz",

View File

@@ -15,6 +15,7 @@
"test:unit": "vitest"
},
"devDependencies": {
"@modyfi/vite-plugin-yaml": "^1.0.4",
"@playwright/test": "^1.28.1",
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.20.4",

36
src/config.ts Normal file
View File

@@ -0,0 +1,36 @@
import configData from './config.yml';
export type Brand = {
logo?: string;
icon?: string;
usemask?: boolean;
};
export type Section = {
title: string;
subtitle?: string;
} & Brand;
export type Service = {
url: string;
target?: string;
type?: string;
[x: string]: unknown;
} & Section;
export type ServiceGroup = {
items: Service[];
} & Section;
export type Config = {
services: ServiceGroup[];
} & Section;
export const config: Config = {
...{
title: 'Flanders',
services: []
},
...configData
};

14
src/config.yml Normal file
View File

@@ -0,0 +1,14 @@
title: 'Hello World !!'
subtitle: 'I am a new pilot.'
services:
- title: '/Cloud'
subtitle: 'Private Cloud Utilities'
icon: 'fas fa-cloud'
items:
- title: 'NAS'
subtitle: 'Network Attached Storage'
icon: 'fas fa-hard-drive'
target: '_blank'
url: '/NAS'
keywords: 'cloud storage files'

View File

@@ -1,2 +1,8 @@
<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
<script lang="ts">
import { config } from '../config';
</script>
<h1>{config.title}</h1>
{#if config.subtitle}
<h2>{config.subtitle}</h2>
{/if}

View File

@@ -8,8 +8,10 @@
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
"strict": true,
"types": ["@modyfi/vite-plugin-yaml/modules"]
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes

View File

@@ -1,8 +1,9 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';
import ViteYaml from '@modyfi/vite-plugin-yaml';
export default defineConfig({
plugins: [sveltekit()],
plugins: [ViteYaml(), sveltekit()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
}