Skip to content

Automatically put the version file in your project dist folder

License

Notifications You must be signed in to change notification settings

xkloveme/vite-plugin-git-version

Repository files navigation

vite-plugin-git-version

A Vite plugin that focuses on generating packaging information for Git projects.

version license

English | 中文

It is better to use with watone tools power builder

Microsoft Store Download

Use Documentation

Get the version information from package.json, then automatically put the version file version.json in your project dist folder when packaging.

// package.json
{
  // ...
  "name": "vite-plugin-git-version",
  "version": "1.0.0"
}
// dist/version.json
{
  "name": "vite-plugin-git-version",
  "version": "1.0.0",
  "branch": "(HEAD -> main, origin/main, origin/HEAD)",
  "hash": "3e85fdd2e0aeac7685e3d20da16ff979440cbcb8",
  "commitUser": "xkloveme (xkloveme@gmail.com)",
  "commitContent": "chore: 更新README和package.json中的依赖信息\n更新版本\nchore: release v1.0.4",
  "time": "2024-08-09 22:13:11"
}

Install

pnpm add vite-plugin-git-version
yarn add vite-plugin-git-version
npm i vite-plugin-git-version

Add plugin to your vite.config.ts or vite.config.js:

// vite.config.ts
import { defineConfig } from 'vite'
import VersionGitPlugin from 'vite-plugin-git-version'

export default defineConfig({
  plugins: [
    VersionGitPlugin(),
  ],
})

License

MIT License © 2024 xkloveme

About

Automatically put the version file in your project dist folder

Resources

License

Stars

Watchers

Forks

Packages

No packages published