Automatically insert the version or git_commit_sha in your project
yarn add -D vite-plugin-version-mark
# OR npm install -D vite-plugin-version-mark
// vite.config.ts
import {defineConfig} from 'vite'
import {vitePluginVersionMark} from 'vite-plugin-version-mark'
export default defineConfig({
plugins: [
vitePluginVersionMark({
// name: 'test-app',
// version: '0.0.1',
ifGitSHA: true,
ifShortSHA: true,
ifMeta: true,
ifLog: true,
ifGlobal: true,
})
],
})
vite-plugin-version-mark
can be print application version in the Console
or add <meta>
in HTML element.
name
- application name (name in package.json
by default)version
- application version (version in package.json
by default)ifGitSHA
- use git commit SHA as the version (false
by default)ifShortSHA
- use git commit short SHA (true
by default)ifMeta
- add <meta name="application-name" content="{APPNAME_VERSION}: {version}"> in the <head> (true
by default)ifLog
- print info in the Console (true
by default)ifGlobal
- set a variable named `__${APPNAME}_VERSION__` in the window. (true
by default)
Then you can use vite-plugin-version-mark
! 🎉