feat: show git tag version
This commit is contained in:
@@ -1,10 +1,32 @@
|
||||
import { execSync } from "node:child_process"
|
||||
import tailwindcss from "@tailwindcss/vite"
|
||||
|
||||
const getRepoVersion = () => {
|
||||
try {
|
||||
const tags = execSync(
|
||||
"git for-each-ref --sort=-version:refname --format='%(refname:short)' refs/tags",
|
||||
{ encoding: "utf8" }
|
||||
)
|
||||
.split("\n")
|
||||
.map((tag) => tag.trim())
|
||||
.filter(Boolean)
|
||||
|
||||
return tags[0] || "dev"
|
||||
} catch {
|
||||
return "dev"
|
||||
}
|
||||
}
|
||||
|
||||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||
export default defineNuxtConfig({
|
||||
compatibilityDate: '2025-07-15',
|
||||
compatibilityDate: "2025-07-15",
|
||||
devtools: { enabled: true },
|
||||
css: ["~/assets/css/main.css"],
|
||||
runtimeConfig: {
|
||||
public: {
|
||||
appVersion: getRepoVersion()
|
||||
}
|
||||
},
|
||||
vite: {
|
||||
plugins: [tailwindcss()]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user