add build version tracking with commit SHA, version number, and build timestamp to frontend
This commit is contained in:
@@ -3,8 +3,22 @@ import react from '@vitejs/plugin-react'
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
|
||||
const appVersion = process.env.npm_package_version ?? '0.0.0'
|
||||
const appCommit = (
|
||||
process.env.GITEA_SHA ??
|
||||
process.env.GITHUB_SHA ??
|
||||
process.env.COMMIT_SHA ??
|
||||
'dev'
|
||||
).slice(0, 12)
|
||||
const appBuiltAt = new Date().toISOString()
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
define: {
|
||||
__APP_VERSION__: JSON.stringify(appVersion),
|
||||
__APP_COMMIT__: JSON.stringify(appCommit),
|
||||
__APP_BUILT_AT__: JSON.stringify(appBuiltAt),
|
||||
},
|
||||
plugins: [
|
||||
react(),
|
||||
tailwindcss(),
|
||||
@@ -35,4 +49,4 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user