nuxt-build-info
Nuxt Build Info
Track deployments with build-time info: version, git details, env context and timestamps for Nuxt apps
✨ Features
- 📦 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
Supported platforms:
- Vercel
- Netlify
- Cloudflare Pages
- GitHub Actions
- Standard Git environments
🚀 Quick Setup
Install the module to your Nuxt application with one command:
- Add
nuxt-build-infodependency 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-infoto themodulessection 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 ✨
📦 Usage
Composables
<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>
App Config
<script setup lang="ts">
const { buildInfo } = useAppConfig()
</script>
<template>
<div>
<h1>Build Info</h1>
<pre>{{ JSON.stringify(buildInfo, null, 2) }}</pre>
</div>
</template>
🤝 Contribution
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
👨💻 Credits
🌻 Sponsors
🏛️ License
Related Packages
vite-plugin-version-mark
A Vite/Nuxt plugin that automatically injects version information (package.json...
353,996
91
nuxt-webpack-optimisations
Nuxt.js module to automatically make your webpack builds faster and smaller.
117,975
268
@koumoul/nuxt-config-inject
Hackish way to obtain "build once - deploy many times" with nuxtjs
4,013
11
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.1.0 | ^3.0 | MIT | |
| 1.0.0 | ^3.0 | MIT |