qduld / vite-plugin-git-revision

Vite plugin that generates VERSION and COMMITHASH files during build based on a local git repository.
8 stars 11 forks source link

How do we use this plugin to get the git version in our app ? #1

Open zonetw opened 3 years ago

zonetw commented 3 years ago

The example only demo a simple HelloWorld app with nothing to do with showing git version. Neither run npm run dev nor npm run build

kozmanbalint commented 2 years ago

Looking at the code the plugin exports the GITVERSION constant to the code space. So console.log(GITVERSION); prints the git info correctly. What I still did, is to put the plugin to the 'pre' order:

plugins: [
    {
      ...GitRevision({branch: true}),
      enforce: 'pre'
    },
    vue(),
  ],
kozmanbalint commented 2 years ago

On the other hand, using branch: true option doesn't seem to have any effect.

qduld commented 2 years ago

The project still needs to be improved, I will improve the function later

qduld commented 2 years ago

I will develop this function , then update the readme file