1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2024-12-08 00:44:30 +01:00

fix(footer): show 0.0.0-development version in Footer in development

This commit is contained in:
Théo LUDWIG 2024-04-06 20:40:25 +02:00
parent cd5e92b64a
commit 0eb780485c
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B
2 changed files with 11 additions and 2 deletions

View File

@ -1,9 +1,10 @@
import { getVersion } from "@/utils/getVersion"
import { FooterText } from "./FooterText"
import { FooterVersion } from "./FooterVersion"
export const Footer = async (): Promise<JSX.Element> => {
const { readPackage } = await import("read-pkg")
const { version } = await readPackage()
const version = await getVersion()
return (
<footer className="flex flex-col items-center justify-center border-t-2 border-gray-600 bg-white py-6 text-lg dark:border-gray-400 dark:bg-black">

8
utils/getVersion.ts Normal file
View File

@ -0,0 +1,8 @@
export const getVersion = async (): Promise<string> => {
if (process.env.NODE_ENV === "development") {
return "0.0.0-development"
}
const { readPackage } = await import("read-pkg")
const { version } = await readPackage()
return version
}