add version in the about page

This commit is contained in:
Yanick Champoux 2023-05-11 10:11:55 -04:00
parent d1a146b281
commit 2ef72888f5
4 changed files with 26 additions and 17 deletions

1
.gitignore vendored
View File

@ -18,3 +18,4 @@ dist/yarn-error.log
dist dist
src/lib/components/__image_snapshots__/__diff_output__/ src/lib/components/__image_snapshots__/__diff_output__/
.histoire/dist .histoire/dist
pnpm-lock.yaml

View File

@ -45,6 +45,8 @@
"@reduxjs/toolkit": "==2.0.0-alpha.5 ", "@reduxjs/toolkit": "==2.0.0-alpha.5 ",
"@yanick/updeep-remeda": "^2.2.0", "@yanick/updeep-remeda": "^2.2.0",
"beercss": "^3.1.3", "beercss": "^3.1.3",
"git-describe": "^4.1.1",
"git-repo-version": "^1.0.2",
"histoire": "^0.16.1", "histoire": "^0.16.1",
"jsdom": "^21.1.1", "jsdom": "^21.1.1",
"lodash": "^4.17.21", "lodash": "^4.17.21",

View File

@ -1,11 +1,7 @@
<div class="header">
<h2>Welcome to the docks!</h2> <h2>Welcome to the docks!</h2>
<div>version {`import.meta.env.PACKAGE_VERSION`}</div>
<!-- TODO </div>
<p class="version">
<span>version {import.meta.env.PACKAGE_VERSION}</span>
<a>changelog</a>
</p>
-->
<p> <p>
The Docks is a ship builder for the game The Docks is a ship builder for the game
@ -36,10 +32,18 @@
<style> <style>
h2 { h2 {
margin-bottom: 1.5rem; margin-bottom: 1.5rem;
flex: 1;
} }
p { p {
font-size: var(--font-scale-11); font-size: var(--font-scale-11);
margin-bottom: 1.5rem; margin-bottom: 1.5rem;
margin-left: 1rem; margin-left: 1rem;
} }
.header {
display: flex;
align-items: baseline;
}
.header div {
font-size: var(--font-scale-11);
}
</style> </style>

View File

@ -1,6 +1,8 @@
// vite.config.js // vite.config.js
import { sveltekit } from "@sveltejs/kit/vite"; import { sveltekit } from "@sveltejs/kit/vite";
import packageJson from "./package.json"; import packageJson from "./package.json";
import getVersion from "git-repo-version";
import git from "git-describe";
/** @type {import('vite').UserConfig} */ /** @type {import('vite').UserConfig} */
const config = { const config = {
@ -9,7 +11,7 @@ const config = {
ssr: {}, ssr: {},
optimizeDeps: {}, optimizeDeps: {},
define: { define: {
"import.meta.env.PACKAGE_VERSION": JSON.stringify(packageJson.version), "import.meta.env.PACKAGE_VERSION": git.gitDescribeSync().semverString,
"import.meta.env.HOMEPAGE": JSON.stringify(packageJson.homepage), "import.meta.env.HOMEPAGE": JSON.stringify(packageJson.homepage),
"import.meta.env.BUGS": JSON.stringify(packageJson.bugs.url), "import.meta.env.BUGS": JSON.stringify(packageJson.bugs.url),
}, },