Track deployments with build-time info: version, git details, env context and timestamps for Nuxt apps
- 📦 Version - Track your application version
- 🔄 Commit - Full commit hash for precise tracking
- 📎 Short Commit - Abbreviated commit hash for display
- 🌿 Branch - Current branch name
- 🚀 Env - Environment context (dev, preview, canary, release)
- ⏱️ Time - Build timestamp for tracking deployments
- Vercel
- Netlify
- Cloudflare Pages
- GitHub Actions
- Standard Git environments
Install the module to your Nuxt application with one command:
- Add
nuxt-build-info
dependency to your project
# Using pnpm
pnpm add -D nuxt-build-info
# Using yarn
yarn add --dev nuxt-build-info
# Using npm
npm install --save-dev nuxt-build-info
- Add
nuxt-build-info
to themodules
section ofnuxt.config.ts
export default defineNuxtConfig({
modules: [
'nuxt-build-info'
],
buildInfo: {
// Optional: Set a custom version instead of package.json version
version: '1.0.0-custom',
}
})
That's it! You can now use Nuxt Build Info in your Nuxt app ✨
<script setup lang="ts">
const { version, commit, shortCommit, branch, env, time } = useBuildInfo()
</script>
<template>
<div>
<h1>Build Info</h1>
<p>Version: {{ version }}</p>
<p>Commit: {{ commit }}</p>
</div>
</template>
<script setup lang="ts">
const { buildInfo } = useAppConfig()
</script>
<template>
<div>
<h1>Build Info</h1>
<pre>{{ JSON.stringify(buildInfo, null, 2) }}</pre>
</div>
</template>
Local development
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch