1.0.2 • Published 6 months ago

@lphal/vite-plugin-git-info v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

vite-plugin-git-info

Generate git information based on git-rev-sync, and output git information to file.

Install

npm install @lphal/vite-plugin-git-info -D

Usage

import { defineConfig } from 'vite'
import { gitInfo, gitInfoToFile } from '@lphal/vite-plugin-git-info'

export default defineConfig({
    plugins: [
        gitInfoToFile()
    ]
})

API

gitInfo

An Object has the following properties:

  • gitInfo.branch: () => string

      branch name, such as `master` or `dev`.
  • gitInfo.short: () => string

      short commit hash for latest commit, such as `7d7j3t`.
  • gitInfo.date: () => Date

      latest commit date, such as `2021-04-27T09:12:23.000Z`.

gitInfoToFile

An vite plugin, output git information to file. It will generate a file named git-info.json in dist folder by default.

type: (options?: { fileName?: string }) => Plugin

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago