From eb44208419b04dc517ee2c56fd1b3ca989838e95 Mon Sep 17 00:00:00 2001 From: Neshura Date: Thu, 4 Jan 2024 00:53:28 +0100 Subject: [PATCH] Including Version number on about page --- src/routes/about/+page.svelte | 12 ++++++++++++ svelte.config.js | 9 ++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelte index ad20cef..cae5ea5 100644 --- a/src/routes/about/+page.svelte +++ b/src/routes/about/+page.svelte @@ -1,8 +1,20 @@ + + About +

+ Version: + + {version} + +

+ +

Background

Foreground

Muted

diff --git a/svelte.config.js b/svelte.config.js index 42f2953..1204dd7 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,6 +1,10 @@ import adapter from '@sveltejs/adapter-auto'; import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; -import path from "path"; +import { readFileSync } from 'node:fs'; +import { fileURLToPath } from 'node:url'; + +const path = fileURLToPath(new URL('package.json', import.meta.url)); +const pkg = JSON.parse(readFileSync(path, 'utf8')); /** @type {import('@sveltejs/kit').Config} */ const config = { @@ -13,6 +17,9 @@ const config = { // 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. adapter: adapter(), + version: { + name: pkg.version + } } };