Skip to content

Commit fed9bec

Browse files
committed
feat: add commit hash display and source link in AboutView
1 parent 25c1576 commit fed9bec

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

src/views/AboutView.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<script setup lang="ts">
22
import { usePageHead } from "@/script/routing"
3+
import { computed } from "vue"
4+
5+
const hash = computed(() => import.meta.env.VITE_GIT_COMMIT_HASH)
6+
const commitUrl = computed(() => `https://github.com/BloomyInDev/Portfolio/commit/${hash.value}`)
37
48
usePageHead()
59
</script>
@@ -17,6 +21,12 @@ usePageHead()
1721
Vous pouvez également obtenir un lien pour mon CV
1822
<a href="/cvWebBastienLuben.pdf" target="_blank">ici</a>.
1923
</p>
24+
<p>Ce site a été développé par Bastien LUBEN en utilisant Vite et Vue.js.</p>
25+
<p>
26+
Le code source est disponible sur
27+
<a href="https://github.com/BloomyInDev/Portfolio" target="_blank">GitHub</a>. Hash de
28+
commit: <a :href="commitUrl">{{ hash }}</a>
29+
</p>
2030
</section>
2131
</template>
2232

vite.config.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ import vueDevTools from "vite-plugin-vue-devtools"
77

88
import { projects } from "./src/script/projects"
99
import type { CustomRouteMetadata } from "./src/types"
10+
import type { RouteRecordRaw } from "vue-router"
11+
12+
import * as child from "child_process"
13+
14+
process.env.VITE_GIT_COMMIT_HASH = child.execSync("git rev-parse --short HEAD").toString()
1015

1116
// https://vite.dev/config/
1217
export default {
@@ -20,8 +25,8 @@ export default {
2025
},
2126
},
2227
ssgOptions: {
23-
includedRoutes(_paths, routes) {
24-
return routes.flatMap((route) => {
28+
includedRoutes: (_paths, routes: Readonly<RouteRecordRaw[]>) => {
29+
return routes.flatMap((route: RouteRecordRaw) => {
2530
return (route.meta as CustomRouteMetadata).dontPregenerate
2631
? []
2732
: route.name == "project-detail"

0 commit comments

Comments
 (0)