vite-plugin-git-mark
v1.0.2
Published
Adds metadata about the current git repo state to entry points at build time
Downloads
7
Maintainers
Readme
vite-plugin-git-mark
Adds metadata about the current git repo state to entry points at build time
Usage
The plugin is a raw object
import gitMarkPlugin from "vite-plugin-factory";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [ gitMarkPlugin() ]
// ...
});Result
The plugin will add some debug informations at the top of entry points using the right syntax depending on the language
- HTML
<!-- Git metadata: {"commit":"64050e6a6345b171a35f81833367ba486ca13338","branch":"main","pending":false,"time":"2025-06-14T00:43:58.551Z"} --> ... - JavaScript (Or TypeScript)
// Git metadata: {"commit":"64050e6a6345b171a35f81833367ba486ca13338","branch":"main","pending":false,"time":"2025-06-14T00:43:58.551Z"} ... - Etc
Metadata
These are the informations that get added to the entry points
commit: The full hash of the current git commit at build timebranch: The name of the current git branch at build timepending: Tells whether the build has been made while there were some pending changesfalse: It generally means that the commit contains all the right code to reproduce this buildtrue: It generally means that, after the build, the pending changes that generated this build have been either discarded or committed on one of the commits that start from the current one at build time
time: The moment at which the build was started
