makes version dynamic

This commit is contained in:
Christian Beutel
2025-01-05 13:00:20 +01:00
parent 43dacb3818
commit 49ba105a95
4 changed files with 21 additions and 3 deletions

View File

@@ -1,4 +1,6 @@
---
import { version } from '../../package.json';
const isNotHomepage = Astro.props.slug !== "";
---
@@ -111,7 +113,7 @@ const isNotHomepage = Astro.props.slug !== "";
class="fill-primary dark:fill-white"
font-size="0.75rem"
>
v0.12.0
v{version}
</text>
</svg>
</div>

View File

@@ -1,3 +1,7 @@
<script lang="ts">
import { version } from "$app/environment";
</script>
<svg
width="212"
height="64"
@@ -97,5 +101,5 @@
d="M43.857 43.3045C44.0569 43.0652 44.4246 43.0652 44.6245 43.3045L46.6259 45.7008C46.8978 46.0263 46.6663 46.5213 46.2421 46.5213H42.2394C41.8152 46.5213 41.5837 46.0263 41.8556 45.7008L43.857 43.3045Z"
fill="#242734"
/>
<text x="170" y="64" fill="white" font-size="0.75rem">v0.12.0</text>
<text x="170" y="64" fill="white" font-size="0.75rem">v{version}</text>
</svg>

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -79,6 +79,7 @@
class="rounded-full w-24 aspect-square overflow-hidden relative group"
>
<img
class="object-cover h-full"
src={getFileURL($currentUser, $currentUser.avatar) ||
`https://api.dicebear.com/7.x/initials/svg?seed=${$currentUser.username}&backgroundType=gradientLinear`}
alt="avatar"

View File

@@ -1,6 +1,13 @@
import adapter from '@sveltejs/adapter-node';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
const file = fileURLToPath(new URL('package.json', import.meta.url));
const json = readFileSync(file, 'utf8');
const pkg = JSON.parse(json);
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
@@ -14,7 +21,11 @@ const config = {
// 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.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter()
adapter: adapter(),
version: {
name: pkg.version
}
}
};