feat: show version in dev panel

wip/tools
Tomáš Mládek 2022-07-26 19:43:55 +02:00
parent 637eaa7f55
commit d6e02406d8
3 changed files with 26 additions and 4 deletions

View File

@ -544,10 +544,18 @@
<div>
<span>Zoom level:</span><span>{Math.round(bbox.z * 1000) / 1000}</span>
</div>
<label
><input bind:checked={showInternal} type="checkbox" />Show internal
elements</label
>
<div>
<label>
<input bind:checked={showInternal} type="checkbox" />
Show internal elements
</label>
</div>
<div>
<!-- svelte-ignore missing-declaration -->
<p class="version">
Version - {__COMMIT_HASH__}
</p>
</div>
</div>
</div>
@ -598,6 +606,13 @@
border: 2px solid white;
font-family: monospace;
padding: 1em 2em;
.version {
text-align: center;
font-weight: bold;
width: 100%;
margin: 0.5em;
}
}
.devpanel div {

1
src/vite-env.d.ts vendored
View File

@ -1,2 +1,3 @@
/// <reference types="svelte" />
/// <reference types="vite/client" />
declare const __COMMIT_HASH__: string

View File

@ -1,8 +1,14 @@
import { defineConfig } from "vite";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import cp from "child_process";
const commitHash = cp.execSync("git rev-parse --short HEAD").toString();
// https://vitejs.dev/config/
export default defineConfig({
plugins: [svelte()],
base: "",
define: {
__COMMIT_HASH__: JSON.stringify(commitHash),
},
});