mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-20 06:55:06 -04:00
feat: added commit short sha
This commit is contained in:
parent
f544928402
commit
668625c6da
3 changed files with 31 additions and 14 deletions
8
env.d.ts
vendored
8
env.d.ts
vendored
|
@ -5,10 +5,10 @@ interface ImportMetaEnv {
|
|||
VITE_PLAUSIBLE_API_HOST: string;
|
||||
VITE_PLAUSIBLE_DOMAIN: string;
|
||||
PACKAGE_VERSION: string;
|
||||
GIT_SHORT_SHA: string;
|
||||
PROD: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ const activeKey = ref(null)
|
|||
const route = useRoute()
|
||||
const styleStore = useStyleStore()
|
||||
const version = import.meta.env.PACKAGE_VERSION;
|
||||
const commitSha = import.meta.env.GIT_SHORT_SHA;
|
||||
|
||||
const makeLabel = (text: string, to: string) => () => h(RouterLink, { to }, { default: () => text })
|
||||
const makeIcon = (icon: Component) => () => h(NIcon, null, { default: () => h(icon) })
|
||||
|
@ -88,6 +89,21 @@ const m = toolsByCategory.map(category => ({
|
|||
>
|
||||
v{{ version }}
|
||||
</n-button>
|
||||
|
||||
<template v-if="commitSha && commitSha.length > 0">
|
||||
-
|
||||
<n-button
|
||||
text
|
||||
tag="a"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
type="primary"
|
||||
depth="3"
|
||||
:href="`https://github.com/CorentinTh/it-tools/tree/v${commitSha}`"
|
||||
>
|
||||
{{ commitSha }}
|
||||
</n-button>
|
||||
</template>
|
||||
</div>
|
||||
<div>
|
||||
© {{ new Date().getFullYear() }}
|
||||
|
|
|
@ -61,5 +61,6 @@ export default defineConfig({
|
|||
},
|
||||
define: {
|
||||
'import.meta.env.PACKAGE_VERSION': JSON.stringify(process.env.npm_package_version),
|
||||
'import.meta.env.GIT_SHORT_SHA': JSON.stringify((process?.env?.VITE_VERCEL_GIT_COMMIT_SHA ?? '').slice(0, 7)),
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue