Vite plugin that generates VERSION and COMMITHASH files during build based on a local git repository.
npm install vite-plugin-git-revisionbash
$ npm install -D vite-plugin-git-revision
`
Add to your vite.config.js:
`js
import Vue from '@vitejs/plugin-vue';
import GitRevision from 'vite-plugin-git-revision';
export default {
plugins: [
Vue(),
GitRevision()
],
};
`
Configuration
To use custom configuration, pass your options to Pages when instantiating the plugin:
`js
// vite.config.js
import GitRevision from 'vite-plugin-git-revision';
export default {
plugins: [
GitRevision({
lightweightTags:false,
branch:false,
versionCommand:'describe --tags --long --dirty --always',
commithashCommand:'',
branchCommand:'',
}),
],
};
`
$3
- Type: boolean
- Default: false
lightweight tags support.
$3
- Type: boolean
- Default: false
branch tags support.
$3
- Type: string
- Default: describe --always
change the default git command used to read the value of VERSION.
$3
- Type: string
- Default: rev-parse HEAD
change the default git command used to read the value of COMMITHASH.
$3
- Type: string
- Default: rev-parse --abbrev-ref HEAD`